-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
54 lines (40 loc) · 1.4 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
cmake_minimum_required(VERSION 3.0.0)
project(conduit CXX)
add_library(conduit INTERFACE)
option(CONDUIT_Install "Install CMake targets during install step." ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (MSVC)
target_compile_options(conduit INTERFACE "/std:c++latest" "/EHsc")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
target_Compile_options(conduit INTERFACE "-std=c++20")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
target_compile_options(conduit INTERFACE "-std=c++20" "-fcoroutines")
endif()
target_compile_definitions(conduit INTERFACE)
target_include_directories(
conduit
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>
$<INSTALL_INTERFACE:include>
)
install(
DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION include
)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
endif()
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
file(GLOB all_tests "test/*.cpp")
foreach(file_name ${all_tests})
get_filename_component(test_name ${file_name} NAME_WE)
add_executable("${test_name}" "${file_name}")
target_link_libraries("${test_name}" PRIVATE conduit)
target_link_libraries("${test_name}" PRIVATE Threads::Threads)
add_test(NAME "${test_name}" COMMAND "${test_name}")
endforeach()
endif()