forked from zserge/tray
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
48 lines (40 loc) · 1.55 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
cmake_minimum_required(VERSION 3.0.0)
project(tray VERSION 0.1.0 LANGUAGES C CXX)
include(CTest)
enable_testing()
add_library(tray src/tray.cpp src/raw_tray.c )
target_include_directories(tray
PUBLIC
include
)
if(UNIX AND NOT APPLE)
find_package(PkgConfig REQUIRED)
message(STATUS "To install appindicator3[ayatana-appindicator3-0.1], sudo apt install libayatana-appindicator3-dev")
pkg_check_modules(APPINDICATOR REQUIRED ayatana-appindicator3-0.1)
target_compile_options(tray PRIVATE ${APPINDICATOR_CFLAGS})
target_link_libraries(tray PRIVATE ${APPINDICATOR_LIBRARIES})
target_link_directories(tray PRIVATE ${APPINDICATOR_LIBRARY_DIRS})
pkg_check_modules(GTK REQUIRED gtk+-3.0)
target_compile_options(tray PRIVATE ${GTK_CFLAGS})
target_link_libraries(tray PRIVATE ${GTK_LIBRARIES})
target_link_directories(tray PRIVATE ${GTK_LIBRARY_DIRS})
elseif(APPLE)
target_link_libraries(tray PRIVATE "-framework Cocoa")
endif()
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
add_executable(tray_test example/example.c)
target_link_libraries(tray_test PRIVATE tray)
add_executable(traypp_test example/example_pp.cpp)
set_target_properties(traypp_test PROPERTIES CXX_STANDARD 17)
target_link_libraries(traypp_test PRIVATE tray)
add_custom_command(
TARGET tray_test
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different
${CMAKE_SOURCE_DIR}/example/
${CMAKE_BINARY_DIR}/
)
endif()
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)