-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
79 lines (58 loc) · 1.95 KB
/
CMakeLists.txt
File metadata and controls
79 lines (58 loc) · 1.95 KB
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
cmake_minimum_required (VERSION 3.10.0)
# Fix behavior of CMAKE_CXX_STANDARD when targeting macOS.
if (POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif ()
# Fix a warning on macOS.
if (POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif ()
# Don't use -rdynamic since it breaks musl static linking.
if (POLICY CMP0065)
cmake_policy(SET CMP0065 NEW)
endif ()
project (p-load)
find_package(PkgConfig)
# Make 'Release' be the default build type.
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "Release" CACHE STRING
"Options are Debug Release RelWithDebInfo MinSizeRel" FORCE)
endif ()
set(USE_SYSTEM_TINYXML2 FALSE CACHE BOOL
"True if you want to use TinyXML-2 from the system instead of the bundled one.")
# Our C++ code uses features from the C++11 standard.
macro(use_cxx11)
if (CMAKE_VERSION VERSION_LESS "3.1")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
endif ()
else ()
set (CMAKE_CXX_STANDARD 11)
endif ()
endmacro(use_cxx11)
set (P_LOAD_VERSION_MAJOR 2)
set (P_LOAD_VERSION_MINOR 4)
set (P_LOAD_VERSION_PATCH 0)
set (P_LOAD_VERSION ${P_LOAD_VERSION_MAJOR}.${P_LOAD_VERSION_MINOR}.${P_LOAD_VERSION_PATCH})
if (CMAKE_VERSION VERSION_GREATER "2.8.10")
string(TIMESTAMP YEAR "%Y")
endif ()
# Put libraries and executables in the top level of the build directory.
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
# Warn about everything.
set (CMAKE_C_FLAGS "-Wall -Wextra ${CMAKE_C_FLAGS}")
set (CMAKE_CXX_FLAGS "-Wall -Wextra ${CMAKE_CXX_FLAGS}")
if (WIN32)
# Enable correct behavior for the return value of vsnprintf.
add_definitions (-D__USE_MINGW_ANSI_STDIO=1)
endif ()
# Detect Linux.
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set (LINUX 1)
endif ()
file(WRITE "${CMAKE_BINARY_DIR}/version.txt" "${P_LOAD_VERSION}")
add_subdirectory (src)
if (NOT USE_SYSTEM_TINYXML2)
add_subdirectory (tinyxml2)
endif ()