-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
61 lines (49 loc) · 1.65 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
cmake_minimum_required(VERSION 3.0.0)
project(ZHLT)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
# Set the possible values of build type for cmake-gui
#set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
if(NOT WIN32)
find_package(Threads REQUIRED)
endif()
if(WIN32)
add_definitions(-DSYSTEM_WIN32)
else()
add_definitions(-DSYSTEM_POSIX)
endif()
# Non optimization MSVC-only stuff
if(MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") # Use more than 2 gigabytes of memory on windows on 32 bit
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX)
# @ssrobins at gitlab.kitware.com
add_compile_options(
$<$<CONFIG:>:/MT> #---------|
$<$<CONFIG:Debug>:/MTd> #---|-- Statically link the runtime libraries
$<$<CONFIG:Release>:/MT>) #--|
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
message(STATUS "Building for 64 bit")
else()
message(STATUS "Building for 32 bit")
endif()
option(STATIC "Build statically" OFF)
if(STATIC)
SET(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} "-static")
endif()
if(NOT MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -ggdb -O0")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -ffast-math -funsafe-math-optimizations -funsafe-loop-optimizations")
elseif(MSVC)
# Build with Multiple Processes (/MP)
# Buffer Security Check: No (/GS-)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /GS-")
endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
# In order of importance
add_subdirectory(hlcsg)
add_subdirectory(hlbsp)
add_subdirectory(hlrad)
add_subdirectory(hlvis)
add_subdirectory(ripent)