forked from Penhorse/ismsnoop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetupProject.cmake
37 lines (32 loc) · 1.14 KB
/
SetupProject.cmake
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
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS
PROJECT_VERSION="${PROJECT_VERSION}"
PROJECT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
PROJECT_VERSION_MINOR=${PROJECT_VERSION_MINOR}
PROJECT_VERSION_PATCH=${PROJECT_VERSION_PATCH}
PROJECT_VERSION_TWEAK=${PROJECT_VERSION_TWEAK}
)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(system Linux)
set(compiler_flags "--std=c++11 -Wall")
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(compiler_flags "${compiler_flags} -ggdb")
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _DEBUG)
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(system OSX)
set(compiler_flags "-std=c++0x -stdlib=libc++ -Wall")
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(system Windows)
set(compiler_flags "/EHsc /MP")
set(CMAKE_CXX_FLAGS_DEBUG "/MTd")
set(CMAKE_CXX_FLAGS_RELEASE "/MT")
endif()
set(CMAKE_CXX_FLAGS "${compiler_flags}")
set(dir_bin bin)
set(dir_lib lib)
set(dir_inc include)
set(dir_src src)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${dir_lib})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dir_lib})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir_bin})