35 lines
1.5 KiB
CMake
35 lines
1.5 KiB
CMake
CMAKE_MINIMUM_REQUIRED(VERSION 3.10 FATAL_ERROR)
|
|
SET(PROJECT_TARGET dhcp_tools)
|
|
PROJECT(${PROJECT_TARGET} LANGUAGES C)
|
|
|
|
FIND_PACKAGE(PkgConfig REQUIRED)
|
|
# sudo apt install libgtk-3-dev
|
|
PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0)
|
|
INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS})
|
|
LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS})
|
|
|
|
INCLUDE_DIRECTORIES(. ${CMAKE_SOURCE_DIR}/srcs/include
|
|
${CMAKE_SOURCE_DIR}/srcs/service/dhcpd/include
|
|
${CMAKE_SOURCE_DIR}/srcs/libs/include)
|
|
|
|
FILE(GLOB PROJECT_HEADS ./*.h)
|
|
AUX_SOURCE_DIRECTORY(./ PROJECT_SRC)
|
|
|
|
ADD_COMPILE_OPTIONS(-Wl,—export-dynamic)
|
|
ADD_LINK_OPTIONS(-rdynamic)
|
|
|
|
ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER})
|
|
|
|
ADD_EXECUTABLE(${PROJECT_TARGET} ${PROJECT_SRC} ${PROJECT_HEADS})
|
|
|
|
TARGET_LINK_LIBRARIES(${PROJECT_TARGET} common ${COMMON_LIBS} ${GTK3_LIBRARIES})
|
|
|
|
# 自动复制配置文件到运行路径
|
|
ADD_CUSTOM_COMMAND(TARGET ${PROJECT_TARGET}
|
|
POST_BUILD
|
|
COMMENT "!!!!!! Notice: Automatic upgreade GTK3 UI files after build project."
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/res/"
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/config/"
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/config/zlog.conf" "${CMAKE_CURRENT_BINARY_DIR}/config/"
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/dhcp_tools/res/style.css" "${CMAKE_CURRENT_BINARY_DIR}/res/"
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/dhcp_tools/res/main.glade" "${CMAKE_CURRENT_BINARY_DIR}/res/") |