forked from groundswellaudio/swl-optional
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
33 lines (21 loc) · 826 Bytes
/
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
cmake_minimum_required(VERSION 3.20)
project(swl.optional
VERSION 1.0.0
LANGUAGES CXX
HOMEPAGE_URL https://github.com/groundswellaudio/swl-optional)
add_library(swl-optional INTERFACE)
target_include_directories(swl-optional INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:./include>)
target_compile_features(swl-optional INTERFACE cxx_std_20)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
file(GLOB test-sources CONFIGURE_DEPENDS tests/*.cpp)
foreach (source IN LISTS test-sources)
get_filename_component(name "${source}" NAME_WE)
set(test "${PROJECT_NAME}-test-${name}")
add_executable(${test} "${source}")
target_link_libraries(${test} swl-optional)
add_test(NAME ${PROJECT_NAME}::test::${name} COMMAND ${test})
endforeach()
endif()