forked from wickedmic/any
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
41 lines (36 loc) · 1.26 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
cmake_minimum_required(VERSION 3.18.4)
cmake_policy(VERSION 3.18.4)
project(anylib VERSION 0.0.1 LANGUAGES CXX)
# Options
option(EXTANY_BUILD_TESTS "build tests" OFF)
option(EXTANY_NO_RTTI "build without runtime type information support" OFF)
# set up library
add_library(anylib INTERFACE ${anylib-source} ${anylib-header})
target_include_directories(anylib INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>
)
target_compile_definitions(anylib INTERFACE $<IF:$<BOOL:${EXTANY_NO_RTTI}>, EXTANY_NO_RTTI, "" >)
target_compile_features(anylib INTERFACE cxx_std_20)
set_target_properties(anylib PROPERTIES EXPORT_NAME any)
add_library(ext::any ALIAS anylib)
# set up folder structure for XCode and VisualStudio
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES "include/ext/any.hpp" "tests/any.cpp")
# set up tests
if(EXTANY_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
# set up installation
install(TARGETS anylib
EXPORT anylib-targets
DESTINATION ${CMAKE_INSTALL_PREFIX}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(
EXPORT anylib-targets
FILE anylib-config.cmake
NAMESPACE ext::
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake
)