forked from afritz1/OpenTESArena
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
44 lines (35 loc) · 1.43 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
CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0)
IF (COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
ENDIF (COMMAND cmake_policy)
PROJECT(OpenTESArena)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/")
# Set global C++ standard for all targets.
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
# Configure for GNU Compiler (also affects MSYS2). Use "MATCHES" instead of "STREQUAL"
# to cover both Clang and AppleClang.
IF (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# To use std::thread and friends, we must pass -lpthread and -pthread to the compiler and Linker for GCC
IF (NOT WIN32 AND NOT APPLE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpthread -pthread")
ENDIF ()
# Optimizations.
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
ENDIF ()
# We want RelWithDebInfo to actually include debug stuff (define _DEBUG
# instead of NDEBUG)
FOREACH(flag_var CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO)
IF(${flag_var} MATCHES "-DNDEBUG")
STRING(REGEX REPLACE "-DNDEBUG" "-D_DEBUG" ${flag_var} "${${flag_var}}")
ENDIF()
ENDFOREACH()
IF (MSVC)
# Add multi-processor compilation.
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
ENDIF ()
ADD_SUBDIRECTORY(components)
ADD_SUBDIRECTORY(OpenTESArena)