forked from e8tools/tool1cd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
66 lines (46 loc) · 1.77 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
cmake_minimum_required(VERSION 2.8)
project(tool1cd_project)
set(SOURCE_DIR ${CMAKE_SOURCE_DIR}/src)
option(NOGUI "disable building GUI project")
set(BINARY_DIR "${CMAKE_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${BINARY_DIR}/lib")
add_definitions (-DBOOST_ALL_NO_LIB)
# Переделываем shared-runtime на static-runtime
# Это нужно, чтобы под Windows Tool1CD не требовал vcredist
if (NOGUI)
set (Boost_USE_STATIC_LIBS ON)
set (Boost_USE_MULTITHREADED OFF)
set (Boost_USE_STATIC_RUNTIME ON)
if (MSVC)
set (Boost_USE_MULTITHREADED ON)
foreach (flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if (${flag_var} MATCHES "/MD")
string (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif (${flag_var} MATCHES "/MD")
endforeach(flag_var)
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:MSVCRT")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:MSVCRT")
set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:MSVCRTD")
endif()
if (CMAKE_COMPILER_IS_GNUCXX)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
endif()
endif()
if (CMAKE_VERSION VERSION_LESS "3.1")
if(CMAKE_COMPILER_IS_GNUCXX)
set (CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}")
endif()
else()
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD_REQUIRED YES)
set (CMAKE_CXX_EXTENSIONS OFF)
endif()
add_subdirectory(${SOURCE_DIR}/tool1cd)
add_subdirectory(${SOURCE_DIR}/ctool1cd)
add_subdirectory(${SOURCE_DIR}/tests)
if(NOT NOGUI)
add_subdirectory(${SOURCE_DIR}/gtool1cd)
endif()