-
Notifications
You must be signed in to change notification settings - Fork 18
/
CMakeLists.txt
67 lines (55 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
58
59
60
61
62
63
64
65
66
67
cmake_minimum_required (VERSION 2.8)
project (Tick)
# The version number.
set (Tick_VERSION_MAJOR 1)
set (Tick_VERSION_MINOR 2)
include(CheckCXXCompilerFlag)
enable_language(CXX)
if(CMAKE_HOST_APPLE)
check_cxx_compiler_flag("-stdlib=libc++" COMPILER_HAS_CXX_FLAG_libcxx)
if(COMPILER_HAS_CXX_FLAG_libcxx)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
endif()
set(ENABLE_CXXFLAGS_TO_CHECK
-std=gnu++1y
-std=c++1y
-std=gnu++11
-std=c++11
-std=gnu++0x
-std=c++0x)
foreach(flag ${ENABLE_CXXFLAGS_TO_CHECK})
string(REPLACE "-std=" "_" flag_var ${flag})
string(REPLACE "+" "x" flag_var ${flag_var})
check_cxx_compiler_flag("${flag}" COMPILER_HAS_CXX_FLAG${flag_var})
if(COMPILER_HAS_CXX_FLAG${flag_var})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
break()
endif()
endforeach()
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -VV -C ${CMAKE_CFG_INTDIR})
macro(add_test_executable TEST_NAME_)
set(TEST_NAME "${TEST_NAME_}")
add_executable (${TEST_NAME} EXCLUDE_FROM_ALL test/${TEST_NAME}.cpp ${ARGN})
if(WIN32)
add_test(NAME ${TEST_NAME} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} COMMAND ${TEST_NAME}${CMAKE_EXECUTABLE_SUFFIX})
else()
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
endif()
add_dependencies(check ${TEST_NAME})
set_tests_properties(${TEST_NAME} PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED")
endmacro(add_test_executable)
include(CTest)
install (DIRECTORY tick DESTINATION include)
configure_file(tick.pc.in tick.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tick.pc DESTINATION lib/pkgconfig)
include_directories(.)
add_test_executable(builder)
add_test_executable(fold)
add_test_executable(integral_constant)
add_test_executable(matches)
add_test_executable(requires)
add_test_executable(set)
add_test_executable(tag)
add_test_executable(trait_check)
add_test_executable(traits)