-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
61 lines (53 loc) · 2.12 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
project(serenity)
###############################################################################
# Serenity - Build
# Builds Serenity Examples
# Builds Serenity Unit Tests
# Builds Serenity Documentation
###############################################################################
cmake_minimum_required(VERSION 2.8)
set(Boost_USE_MULTITHREADED ON)
find_package(Boost 1.69.0 REQUIRED COMPONENTS system filesystem thread)
find_package(Threads REQUIRED)
if (CMAKE_THREAD_LIBS_INIT)
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
endif(CMAKE_THREAD_LIBS_INIT)
include(CheckCXXCompilerFlag)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
check_cxx_compiler_flag("-std=c++11" HAS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# Dunno what to do here yet.
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
check_cxx_compiler_flag("-std=c++11" HAS_CXX11)
check_cxx_compiler_flag("-stdlib=libc++" HAS_LIBCXX)
check_cxx_compiler_flag("-stdlib=libstdc++" HAS_LIBSTDCXX)
if (HAS_LIBCXX)
message("Using libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -lc++")
elseif(HAS_LIBSTDCXX)
message("Using libstdc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libstdc++")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -lstdc++")
endif()
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
check_cxx_compiler_flag("-std=c++11" HAS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
endif()
if (NOT HAS_CXX11)
message(FATAL_ERROR "Serenity requires a C++ compiler that supports C++11.")
endif()
include_directories(include ${Boost_INCLUDE_DIRS})
# Unit Tests
add_subdirectory(test)
# Documentation
add_subdirectory(docs)
# Examples
add_subdirectory(examples)
# Spikes
add_subdirectory(spikes)
# Enable 'make test'
#enable_testing()
#add_test(NAME SerenityTest COMMAND tests --reporter compact)