yacos/CMakeLists.txt

29 lines
1.4 KiB
CMake
Raw Normal View History

2019-07-20 14:22:48 +02:00
cmake_minimum_required(VERSION 2.8)
project(yacos)
2019-07-20 14:50:57 +02:00
#set(CMAKE_BUILD_TYPE Release)
set(CMAKE_C_FLAGS "-Wall")
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)
INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS} ${GOBJECT2_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS})
LINK_DIRECTORIES (${GLIB2_LIBRARY_DIRS} ${GOBJECT2_LIBRARY_DIRS} ${GTK3_LIBRARY_DIRS})
add_definitions(${GLIB2_CFLAGS_OTHER} ${GOBJECT2_CFLAGS_OTHER} ${GTK3_CFLAGS_OTHER})
add_custom_target(glib-resources DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/resources.c)
add_custom_command(DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/glade/*.glade "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.gresource.xml"
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/resources.c
COMMAND glib-compile-resources --target="${CMAKE_CURRENT_BINARY_DIR}/resources.c" --sourcedir="${CMAKE_CURRENT_SOURCE_DIR}" --generate-source "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.gresource.xml")
2019-07-20 23:50:50 +02:00
FILE(GLOB_RECURSE HEADERS "src/*.h")
2019-07-20 14:50:57 +02:00
aux_source_directory(./src SRC_LIST)
2019-07-20 23:50:50 +02:00
add_executable(${PROJECT_NAME} ${SRC_LIST} "${CMAKE_CURRENT_BINARY_DIR}/resources.c" "${HEADERS}")
2019-07-20 14:50:57 +02:00
add_dependencies(${PROJECT_NAME} glib-resources)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/resources.c PROPERTIES GENERATED 1)
target_link_libraries(${PROJECT_NAME} ${GTK3_LIBRARIES})
install (TARGETS ${PROJECT_NAME} DESTINATION bin)