-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
83 lines (73 loc) · 3.07 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
cmake_minimum_required (VERSION 3.5)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
project (CrissCross CXX)
option(USE_OPENMP "Build with OpenMP support" ON)
include(CheckCXXCompilerFlag)
set(CC_COMMON_FLAGS
-fno-strict-aliasing
-fvisibility=hidden
-rdynamic
-Wall
-Wundef
-Wno-long-long
-pedantic)
set(CC_CXX_FLAGS
-Wno-non-virtual-dtor
-Wno-reorder
-fno-exceptions
-fno-rtti
-fvisibility-inlines-hidden)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU"
OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
foreach(FLAG ${CC_COMMON_FLAGS} ${CC_CXX_FLAGS})
string(MAKE_C_IDENTIFIER ${FLAG} FLAG_ID)
check_cxx_compiler_flag(${FLAG} ${FLAG_ID}_TEST)
if(${FLAG_ID}_TEST)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:${FLAG}>)
endif()
endforeach()
endif()
# settings for Microsoft Visual C
IF(MSVC)
IF(NOT WITH_SHARED_LIBS)
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 7" OR CMAKE_GENERATOR STREQUAL "Visual Studio 7 .NET 2003")
SET(CMAKE_C_FLAGS "/nologo /W3 /Gy /Gm /G6 /GS- /Zi")
SET(CMAKE_C_FLAGS_DEBUG "/MTd /Zi /Od")
SET(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Ot")
SET(CMAKE_C_FLAGS_MINSIZEREL "/MT /O2 /Os")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/MTd /Od")
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 7" OR CMAKE_GENERATOR STREQUAL "Visual Studio 7 .NET 2003")
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008")
SET(CMAKE_C_FLAGS "/nologo /W3 /Gy /Gm /GS- /Zi /openmp")
SET(CMAKE_C_FLAGS_DEBUG "/MTd /Od")
SET(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Ot")
SET(CMAKE_C_FLAGS_MINSIZEREL "/MT /O2 /Os")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/MTd /Od")
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008")
ENDIF(NOT WITH_SHARED_LIBS)
ENDIF(MSVC)
# settings for Microsoft Visual C++
IF(MSVC)
IF(NOT WITH_SHARED_LIBS)
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 7" OR CMAKE_GENERATOR STREQUAL "Visual Studio 7 .NET 2003")
SET(CMAKE_CXX_FLAGS "/nologo /W3 /Gy /G6 /Gm /GS- /Zi /EHa")
SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Od")
SET(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Ot")
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2 /Os")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Od")
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 7" OR CMAKE_GENERATOR STREQUAL "Visual Studio 7 .NET 2003")
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008")
SET(CMAKE_CXX_FLAGS "/nologo /W3 /Gy /Gm /GS- /Zi /EHa /openmp")
SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Od")
SET(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Ot")
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2 /Os")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Od")
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008")
ENDIF(NOT WITH_SHARED_LIBS)
ENDIF(MSVC)
add_subdirectory (source)
add_subdirectory (TestSuite)
add_subdirectory (examples)
IF(NOT MSVC)
add_custom_target (check COMMAND $<TARGET_FILE:TestSuite> DEPENDS TestSuite)
ENDIF(NOT MSVC)