-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
64 lines (47 loc) · 1.58 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
##################################################################
#
# To compile, set target manually below:
#
# "auto" Attempt to autodetect
# "osx" MacOS
# "windows" Windows
# "linux" Linux
#
##################################################################
##################################################################
set(EXPORT_TARGET "auto")
##################################################################
##################################################################
# set cmake version
cmake_minimum_required(VERSION 3.10)
# set the project name
project(reflect_demo)
# glob the files, add the executable
file(GLOB SOURCE_CODE_FILES
"example/*.c**"
)
add_executable(${PROJECT_NAME} ${SOURCE_CODE_FILES})
# include directories
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/example)
include_directories(${CMAKE_SOURCE_DIR}/src)
# determine target
if (EXPORT_TARGET MATCHES "auto")
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(EXPORT_TARGET "osx")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(EXPORT_TARGET "windows")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(EXPORT_TARGET "linux")
endif()
endif()
# export target
if (EXPORT_TARGET MATCHES "osx")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_COMPILER "g++")
elseif (EXPORT_TARGET MATCHES "windows")
### TODO ###
elseif (EXPORT_TARGET MATCHES "linux")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_COMPILER "g++")
endif()