-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
115 lines (92 loc) · 4.6 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
cmake_minimum_required(VERSION 3.0)
project(CmusControl)
set(PROJECT_RELEASE_ID 5)
set(PROJECT_VERSION_MAJOR 1)
set(PROJECT_VERSION_MINOR 2)
set(PROJECT_VERSION_PATCH 0)
set(PROJECT_VERSION_APPENDIX "")
set(PROJECT_COPYRIGHT "Copyright (C) 2015 Christian Mayer <https://fox21.at>")
set(PROJECT_USE_PID_FILE 0)
set(PROJECT_INSTALL_BIN_DST_PATH "/usr/local/bin")
set(PROJECT_INSTALL_LAUNCHAGENTS_DST_PATH "~/Library/LaunchAgents")
set(USE_ARC 1)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8")
set(CMAKE_C_FLAGS "-Wall")
set(CMAKE_C_FLAGS_DEBUG "-g -O0 -DDEBUG -Wunused-variable")
set(CMAKE_C_FLAGS_RELEASE "-Os -DNDEBUG -Wno-unused-variable")
set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
if(${USE_ARC})
message(STATUS "USE ARC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fobjc-arc")
set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
else()
message(STATUS "NO ARC")
endif()
configure_file("${PROJECT_SOURCE_DIR}/src/config.h.in" "${PROJECT_BINARY_DIR}/src/config.h" NEWLINE_STYLE LF)
configure_file("${PROJECT_SOURCE_DIR}/skel/at.fox21.cmuscontrold.plist" "${PROJECT_BINARY_DIR}/skel/at.fox21.cmuscontrold.plist" NEWLINE_STYLE LF)
file(GLOB_RECURSE PROJECT_SOURCES "src/*.m")
set(PROJECT_INCLUDE_DIRS "")
foreach(_srcFile ${PROJECT_SOURCES})
get_filename_component(_dir ${_srcFile} PATH)
list(APPEND PROJECT_INCLUDE_DIRS ${_dir})
endforeach()
list(REMOVE_DUPLICATES PROJECT_INCLUDE_DIRS)
include_directories(${PROJECT_INCLUDE_DIRS})
include_directories("${PROJECT_BINARY_DIR}/src")
FIND_LIBRARY(FOUNDATION_LIBRARY Foundation)
FIND_LIBRARY(APPKIT_LIBRARY AppKit)
add_executable(cmuscontrold
src/main.m
src/classes/CCApplication.m
)
target_link_libraries(cmuscontrold ${FOUNDATION_LIBRARY})
target_link_libraries(cmuscontrold ${APPKIT_LIBRARY})
if(${CMAKE_BUILD_TYPE} STREQUAL "Release")
add_custom_command(TARGET cmuscontrold POST_BUILD COMMAND strip ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cmuscontrold)
endif()
install(TARGETS cmuscontrold
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
RUNTIME DESTINATION ${PROJECT_INSTALL_BIN_DST_PATH}
CONFIGURATIONS Release)
install(FILES "${PROJECT_BINARY_DIR}/skel/at.fox21.cmuscontrold.plist"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
DESTINATION ${PROJECT_INSTALL_LAUNCHAGENTS_DST_PATH}
CONFIGURATIONS Release)
add_custom_target(uninstall
COMMAND rm -vf "${PROJECT_INSTALL_LAUNCHAGENTS_DST_PATH}/at.fox21.cmuscontrold.plist"
COMMAND rm -vf "${PROJECT_INSTALL_BIN_DST_PATH}/cmuscontrold"
)
add_custom_target(launchctl_load COMMAND launchctl load "${PROJECT_INSTALL_LAUNCHAGENTS_DST_PATH}/at.fox21.cmuscontrold.plist")
add_custom_target(launchctl_unload COMMAND launchctl unload "${PROJECT_INSTALL_LAUNCHAGENTS_DST_PATH}/at.fox21.cmuscontrold.plist")
MESSAGE("")
MESSAGE(STATUS "CMAKE Version: ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
MESSAGE(STATUS "CMAKE bin: ${CMAKE_COMMAND}")
MESSAGE(STATUS "Compiler: ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER}")
MESSAGE("")
MESSAGE(STATUS "PROJECT: ${PROJECT_NAME} v${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${PROJECT_VERSION_APPENDIX}-${PROJECT_RELEASE_ID}")
MESSAGE(STATUS "PROJECT_SOURCE_DIR: '${PROJECT_SOURCE_DIR}'")
MESSAGE(STATUS "PROJECT_BINARY_DIR: '${PROJECT_BINARY_DIR}'")
MESSAGE(STATUS "PROJECT_INCLUDE_DIRS: '${PROJECT_INCLUDE_DIRS}'")
MESSAGE("")
# MESSAGE(STATUS "CMAKE_CXX_FLAGS: '${CMAKE_CXX_FLAGS}'")
# MESSAGE(STATUS "CMAKE_CXX_FLAGS_DEBUG: '${CMAKE_CXX_FLAGS_DEBUG}'")
# MESSAGE(STATUS "CMAKE_CXX_FLAGS_RELEASE: '${CMAKE_CXX_FLAGS_RELEASE}'")
# MESSAGE(STATUS "CMAKE_CXX_LINK_FLAGS: '${CMAKE_CXX_LINK_FLAGS}'")
# MESSAGE("")
# MESSAGE(STATUS "CMAKE_BINARY_DIR: '${CMAKE_BINARY_DIR}'")
# MESSAGE(STATUS "CMAKE_BUILD_TYPE: '${CMAKE_BUILD_TYPE}'")
# MESSAGE(STATUS "CMAKE_RUNTIME_OUTPUT_DIRECTORY: '${CMAKE_RUNTIME_OUTPUT_DIRECTORY}'")
# MESSAGE(STATUS "LIBRARY_OUTPUT_PATH: '${LIBRARY_OUTPUT_PATH}'")
# MESSAGE(STATUS "RUNTIME_OUTPUT_DIRECTORY: '${RUNTIME_OUTPUT_DIRECTORY}'")
# MESSAGE(STATUS "CMAKE_SYSTEM_FRAMEWORK_PATH: '${CMAKE_SYSTEM_FRAMEWORK_PATH}'")
# MESSAGE(STATUS "CMAKE_SYSTEM_APPBUNDLE_PATH: '${CMAKE_SYSTEM_APPBUNDLE_PATH}'")
MESSAGE(STATUS "MACOSX_DEPLOYMENT_TARGET: '${MACOSX_DEPLOYMENT_TARGET}'")
MESSAGE(STATUS "CMAKE_OSX_DEPLOYMENT_TARGET: '${CMAKE_OSX_DEPLOYMENT_TARGET}'")
MESSAGE(STATUS "CMAKE_OSX_SYSROOT: '${CMAKE_OSX_SYSROOT}'")
MESSAGE("")
# MESSAGE(STATUS "FOUNDATION_LIBRARY: '${FOUNDATION_LIBRARY}'")
# MESSAGE(STATUS "APPKIT_LIBRARY: '${APPKIT_LIBRARY}'")
# MESSAGE("")