-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
35 lines (29 loc) · 1.25 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
# Copyright Louis Dionne 2017
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.10)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
project(awful LANGUAGES CXX)
add_library(awful INTERFACE)
target_include_directories(awful INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
$<INSTALL_INTERFACE:include>)
target_compile_features(awful INTERFACE cxx_std_14)
install(TARGETS awful EXPORT AwfulConfig)
install(EXPORT AwfulConfig DESTINATION lib/cmake/awful)
install(FILES include/awful.hpp DESTINATION include)
enable_testing()
include(compile_fail)
file(GLOB testfiles test/*.cpp)
foreach(testfile ${testfiles})
file(RELATIVE_PATH target "${CMAKE_CURRENT_SOURCE_DIR}" "${testfile}")
string(REPLACE .cpp "" target ${target})
string(REPLACE / "." target ${target})
if (${target} MATCHES "[.]fail")
compile_fail(${target} "${testfile}")
else()
add_executable(${target} "${testfile}")
add_test(${target} ${target})
endif()
target_link_libraries(${target} awful)
set_target_properties(${target} PROPERTIES CXX_EXTENSIONS NO)
endforeach()