-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
54 lines (45 loc) · 1.32 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
cmake_minimum_required (VERSION 3.0)
project (libopenpmd C)
if (${CMAKE_VERSION} VERSION_GREATER "3.0.2")
cmake_policy (SET CMP0054 NEW)
endif ()
set (CMAKE_C_STANDARD 90)
set (CMAKE_C_STANDARD_REQUIRED TRUE)
set (CMAKE_C_EXTENSIONS OFF)
if (MSVC)
# warning level 4 and all warnings as errors
# add_compile_options (/W4 /WX)
# Shut up MSVC about its "better", non-portable functions
add_definitions (/D_CRT_SECURE_NO_WARNINGS)
elseif (${CMAKE_C_COMPILER_ID} MATCHES "GNU|\\.*Clang|\\.*LLVM")
# lots of warnings and all warnings as errors
add_compile_options (-Wall -Wextra -pedantic -Werror -pedantic-errors)
endif ()
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Debug)
endif ()
string (TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UPPER)
if (CMAKE_BUILD_TYPE_UPPER STREQUAL "DEBUG")
if (MSVC)
add_definitions (/DDEBUG)
else ()
add_definitions (-DDEBUG)
endif ()
endif ()
if (CMAKE_SYSTEM_NAME STREQUAL "DOS" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "I86")
set (PREFER_LOWMEM TRUE)
else ()
set (PREFER_LOWMEM FALSE)
endif ()
option (USE_LOWMEM
"Use code that's better suited for low-memory environments"
${PREFER_LOWMEM}
)
message (STATUS "USE_LOWMEM: ${USE_LOWMEM}")
if (USE_LOWMEM)
add_definitions (-DUSE_LOWMEM)
endif ()
include (GNUInstallDirs)
add_subdirectory (include)
add_subdirectory (src)
add_subdirectory (tools)