-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
57 lines (49 loc) · 1.9 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
cmake_minimum_required(VERSION 2.8.11)
# 2.8.11 is required for how we use Qt5.
project(flut)
# To create a folder hierarchy within Visual Studio.
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
find_path(FLUT_INCLUDE_DIR
NAMES flut/system/types.hpp
PATHS ${CMAKE_CURRENT_SOURCE_DIR}
)
# Check required compiler versions
# ---------------
if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
set(FLUT_REQUIRED_GCC_VERSION 5.1.0)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${FLUT_REQUIRED_GCC_VERSION})
message(FATAL_ERROR "GNU GCC/G++ version must be at least version: "
"${FLUT_REQUIRED_GCC_VERSION}. GCC version is "
"${CMAKE_CXX_COMPILER_VERSION}.")
endif()
endif()
# Compiler flags.
# ---------------
# Must compile with C++14 with gcc/clang.
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR
${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
if(APPLE)
if(XCODE)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
endif()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
endif()
# Place build products (libraries, executables) in root
# binary (build) directory. Otherwise, they get scattered around
# the build directory and so the dll's aren't next to the executables.
get_filename_component(CONFIG_NAME "${CMAKE_BINARY_DIR}" NAME)
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin/${CONFIG_NAME}")
set(LIBRARY_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin/${CONFIG_NAME}")
# Process source code.
add_subdirectory(flut)
add_subdirectory(test)
enable_testing()
add_test(flut_test "${CMAKE_SOURCE_DIR}/bin/${CONFIG_NAME}/flut_test")