-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
75 lines (58 loc) · 2.35 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright (c) Darrell Wright
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Official repository: https://github.com/beached/ostreams
#
cmake_minimum_required( VERSION 3.13 )
project( "ostreams"
VERSION "1.0.0"
DESCRIPTION "Test implementation of a more modern ostreams"
HOMEPAGE_URL "https://github.com/beached/ostreams"
LANGUAGES C CXX)
set( CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard whose features are requested.")
set( CMAKE_CXX_STANDARD_REQUIRED ON)
set( CMAKE_CXX_EXTENSIONS OFF)
add_subdirectory(extern)
include( GNUInstallDirs)
set( ostreams_INSTALL_CMAKEDIR
"${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake"
CACHE STRING
"The install directory to use for CMake package config files")
set( PROJECT_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
add_library( ${PROJECT_NAME} INTERFACE )
add_library( daw::${PROJECT_NAME} ALIAS ${PROJECT_NAME} )
target_link_libraries( ${PROJECT_NAME} INTERFACE daw::header_libraries )
target_link_libraries( ${PROJECT_NAME} INTERFACE daw::header_libraries ${COMPILER_SPECIFIC_LIBS} )
target_compile_features( ${PROJECT_NAME} INTERFACE cxx_std_17)
target_include_directories( ${PROJECT_NAME}
INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
install( TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}_Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
include( CMakePackageConfigHelpers)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/daw_${PROJECT_NAME}Config.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION
${ostreams_INSTALL_CMAKEDIR} )
write_basic_package_version_file( "${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)
install( EXPORT ${PROJECT_NAME}_Targets
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE daw::
DESTINATION ${ostreams_INSTALL_CMAKEDIR})
install( FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${ostreams_INSTALL_CMAKEDIR}$ )
install( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include )
if (DAW_ENABLE_TESTING)
add_subdirectory(tests)
endif ()