forked from mpark/variant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
49 lines (37 loc) · 1.41 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
cmake_minimum_required(VERSION 3.6.3)
project(MPark.Variant CXX)
include_directories(include)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(MPARK_VARIANT_INCLUDE_TESTS_DEFAULT "mpark")
else()
set(MPARK_VARIANT_INCLUDE_TESTS_DEFAULT "")
endif()
set(MPARK_VARIANT_INCLUDE_TESTS
${MPARK_VARIANT_INCLUDE_TESTS_DEFAULT}
CACHE STRING
"Semicolon-separated list of tests to build. Possible values are `mpark` and `libc++`.")
list(REMOVE_DUPLICATES MPARK_VARIANT_INCLUDE_TESTS)
list(FIND MPARK_VARIANT_INCLUDE_TESTS "mpark" MPARK_VARIANT_INDEX)
list(REMOVE_ITEM MPARK_VARIANT_INCLUDE_TESTS "mpark")
if(MPARK_VARIANT_INDEX EQUAL -1)
set(MPARK_VARIANT_INCLUDE_MPARK_TESTS OFF)
else()
set(MPARK_VARIANT_INCLUDE_MPARK_TESTS ON)
endif()
list(FIND MPARK_VARIANT_INCLUDE_TESTS "libc++" MPARK_VARIANT_INDEX)
list(REMOVE_ITEM MPARK_VARIANT_INCLUDE_TESTS "libc++")
if(MPARK_VARIANT_INDEX EQUAL -1)
set(MPARK_VARIANT_INCLUDE_LIBCXX_TESTS OFF)
else()
set(MPARK_VARIANT_INCLUDE_LIBCXX_TESTS ON)
endif()
list(LENGTH MPARK_VARIANT_INCLUDE_TESTS MPARK_VARIANT_LENGTH)
if(MPARK_VARIANT_LENGTH GREATER 0)
message(FATAL_ERROR
"The following values in `MPARK_VARIANT_INCLUDE_TESTS` are not one of the \
possible values, `mpark` and `libc++`: ${MPARK_VARIANT_INCLUDE_TESTS}")
endif()
if(MPARK_VARIANT_INCLUDE_MPARK_TESTS OR MPARK_VARIANT_INCLUDE_LIBCXX_TESTS)
enable_testing()
add_subdirectory(test)
endif()