mdiary/CMakeLists.txt

42 lines
1.8 KiB
CMake
Raw Normal View History

2017-01-31 17:18:33 +01:00
cmake_minimum_required(VERSION 2.8)
project(mdiary)
2017-01-31 18:18:10 +01:00
#set(CMAKE_BUILD_TYPE Release)
2017-03-24 20:47:54 +01:00
set(CMAKE_C_FLAGS "-Wall")
2017-01-31 18:18:10 +01:00
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB2 REQUIRED glib-2.0)
pkg_check_modules(GOBJECT2 REQUIRED gobject-2.0)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
2017-02-16 20:06:29 +01:00
pkg_check_modules(WEBKIT REQUIRED webkit2gtk-4.0)
2017-01-31 18:18:10 +01:00
2017-02-16 18:26:38 +01:00
INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS} ${GOBJECT2_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS} ${WEBKIT_INCLUDE_DIRS})
LINK_DIRECTORIES (${GLIB2_LIBRARY_DIRS} ${GOBJECT2_LIBRARY_DIRS} ${GTK3_LIBRARY_DIRS} ${WEBKIT_LIBRARY_DIRS})
add_definitions(${GLIB2_CFLAGS_OTHER} ${GOBJECT2_CFLAGS_OTHER} ${GTK3_CFLAGS_OTHER} ${WEBKIT_CFLAGS_OTHER})
2017-01-31 18:18:10 +01:00
2018-03-17 17:38:32 +01:00
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/resources.c"
COMMAND glib-compile-resources "${CMAKE_CURRENT_SOURCE_DIR}/mdiary.gresource.xml" --target="${CMAKE_CURRENT_BINARY_DIR}/resources.c" --generate-source
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/glade/mainWindow.glade" "${CMAKE_CURRENT_SOURCE_DIR}/mdiary.gresource.xml"
COMMENT "Generating resources"
)
add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/hoedown/libhoedown.a"
COMMAND make libhoedown.a
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/hoedown"
COMMENT "Compiling libhoedown"
)
ADD_LIBRARY(HOEDOWN STATIC IMPORTED)
SET_TARGET_PROPERTIES(HOEDOWN PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/src/hoedown/libhoedown.a"
)
2017-01-31 19:42:41 +01:00
aux_source_directory(./src SRC_LIST)
2017-01-31 18:18:10 +01:00
add_executable(${PROJECT_NAME} ${SRC_LIST})
2018-03-17 17:38:32 +01:00
target_sources(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/resources.c")
target_sources(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src/hoedown/libhoedown.a")
target_link_libraries(${PROJECT_NAME} ${GTK3_LIBRARIES} ${WEBKIT_LIBRARIES} HOEDOWN)
2018-03-17 17:42:17 +01:00
install (TARGETS ${PROJECT_NAME} DESTINATION bin)