-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
40 lines (36 loc) · 1.26 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
cmake_minimum_required(VERSION 3.1.3)
# set some good warning flags
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(cxxFlags
-std=c++11
-fdiagnostics-show-option
-Wall -Wextra -Wpedantic -Weverything
-Wno-c++98-compat-pedantic -Wno-exit-time-destructors
-Werror)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(cxxFlags
-std=c++11
-fdiagnostics-show-option
-Wall -Wextra -Wpedantic -Werror
-Wconversion
-Wno-comment)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# from: https://msdn.microsoft.com/en-us/library/thxezb7y.aspx
# untested
set(cxxFlags
/Wall /WX)
else()
# unknown compiler...
set(cxxFlags "")
endif()
string(REPLACE ";" " " cxxFlags "${cxxFlags}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cxxFlags}")
# a simple showcase of hyper_array's API
set(playground hyper_array_playground)
add_executable(${playground} src/playground.cpp)
target_include_directories(${playground} PRIVATE include)
set_property(TARGET ${playground} PROPERTY CXX_STANDARD 11)
# pragmatic testing using CATCH
file(GLOB test_files "test/*.cpp")
add_executable(tests "${test_files}") # "test" is a reserved target name
set_property(TARGET tests PROPERTY CXX_STANDARD 11)