-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
96 lines (76 loc) · 3.16 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
cmake_minimum_required(VERSION 3.0)
project(cuttlebone)
option(CB_BUILD_EXAMPLES "Build cuttlebone examples" ON)
## XXX some stuff stopped working after i added this. i think that setting
## CMAKE_BUILD_TYPE to "Release" compiles away asserts, which contained some
## critical code. stupid, i know.
##
#set(CMAKE_BUILD_TYPE Release)
#set(CMAKE_CXX_FLAGS "-Wall - std=c++11 -Wno-deprecated-declarations")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wall -Wno-deprecated-declarations")
elseif(APPLE)
set(CMAKE_MACOSX_RPATH 0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-deprecated-declarations")
elseif(WIN32)
message("Windows Cuttlebone")
endif()
#set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
#set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
#set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG")
#set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
#find_package(Crypto REQUIRED)
#set(libraries ${libraries} ${CRYPTO_LIBRARIES})
#find_package(ZLIB REQUIRED)
#set(libraries ${libraries} ${ZLIB_LIBRARIES})
#include_directories(${ZLIB_INCLUDE_DIRS} )
#include_directories(${CRYPTO_INCLUDE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../ms_demos)
#find_package(Threads REQUIRED)
#set(libraries ${CMAKE_THREAD_LIBS_INIT} ${libraries})
#if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# set(libraries ${libraries} rt)
#endif()
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
aux_source_directory(source/macos library_source)
find_library(core_services CoreServices)
set(library_library ${library_library} ${core_services})
add_library(${PROJECT_NAME} SHARED ${library_source})
target_link_libraries(${PROJECT_NAME} ${library_library})
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
aux_source_directory(source/linux library_source)
add_library(${PROJECT_NAME} SHARED ${library_source})
target_link_libraries(${PROJECT_NAME} rt ${library_library})
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
IF(WIN32)
aux_source_directory(source/windows library_source)
add_library(${PROJECT_NAME} ${library_source})
target_link_libraries(${PROJECT_NAME} ${library_library} ws2_32)
ENDIF(WIN32)
set_target_properties(${PROJECT_NAME} PROPERTIES
DEBUG_POSTFIX d
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
)
set(libraries ${PROJECT_NAME} ${libraries})
if (CB_BUILD_EXAMPLES)
aux_source_directory(test source_list)
aux_source_directory(example source_list)
aux_source_directory(scratch source_list)
message("Building cuttlebone examples")
foreach(source_file ${source_list})
string(REGEX REPLACE "/" "_" target ${source_file})
string(REGEX REPLACE ".cpp" "" target ${target})
message("Building example ${source_file}")
add_executable(${target} ${source_file})
set_target_properties(${target} PROPERTIES
DEBUG_POSTFIX d
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
)
target_link_libraries(${target} ${PROJECT_NAME})
endforeach(source_file)
endif()