-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
90 lines (63 loc) · 2.12 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
cmake_minimum_required( VERSION 3.1)
project( mulle-c-string-escape C)
#
# Turn an "Executable" into a "Library"
# * mulle-sde test init
# * mv src/main.m test/10_test/test.m
# Then set MULLE_PROJECT_TYPE to "Library".
# * mulle-sde reflect
# * mulle-sde test
#
set( MULLE_PROJECT_TYPE "Executable")
### mulle-sde environment
# add cmake module paths to search path
list( INSERT CMAKE_MODULE_PATH 0 "${PROJECT_SOURCE_DIR}/cmake/share")
list( INSERT CMAKE_MODULE_PATH 0 "${PROJECT_SOURCE_DIR}/cmake/reflect")
list( INSERT CMAKE_MODULE_PATH 0 "${PROJECT_SOURCE_DIR}/cmake")
include( Environment)
include( Files)
if( "${MULLE_PROJECT_TYPE}" STREQUAL "Executable")
### Executable
include( Dependencies)
include( Executable)
include( InstallExecutable)
# only for Executable
include( Motd OPTIONAL)
elseif( "${MULLE_PROJECT_TYPE}" STREQUAL "Framework")
### Framework
include( Dependencies)
include( Framework)
set_target_properties( "${FRAMEWORK_NAME}" PROPERTIES
FRAMEWORK_VERSION A
)
#
# You usually don't want to link static libraries into a Framework, except
# if you know they won't be shared with other frameworks. So use dynamic_lookup
# to keep those symbols from static libraries "open" for later linking.
#
# Mark static libraries as no-link.
#
target_link_options( "${FRAMEWORK_NAME}" PRIVATE
-undefined dynamic_lookup
)
include( InstallFramework)
elseif( "${MULLE_PROJECT_TYPE}" STREQUAL "Library")
### Library
if( HEADER_PHASE)
install( FILES ${INSTALL_PUBLIC_HEADERS} DESTINATION "include/${PROJECT_NAME}")
install( FILES ${INSTALL_PRIVATE_HEADERS} DESTINATION "include/${PROJECT_NAME}/private")
install( FILES ${CMAKE_INCLUDES} DESTINATION "include/${PROJECT_NAME}/cmake")
# short cut out
if( NOT COMPILE_PHASE AND NOT LINK_PHASE)
return()
endif()
endif()
if( LINK_PHASE)
include( Dependencies OPTIONAL)
endif()
include( Library)
include( InstallLibrary)
else()
message( ERROR "Unknown project type \"${MULLE_PROJECT_TYPE}\"")
endif()
include( FinalOutput OPTIONAL)