-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
64 lines (54 loc) · 1.8 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
#
# Part of CMake configuration for lexertl library
#
# Copyright (c) 2013 Mateusz Loskot <[email protected]>
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
cmake_minimum_required (VERSION 3.5)
project(lexertl VERSION 1.0.0)
# Define project
add_library(lexertl INTERFACE)
target_include_directories(lexertl INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
if (BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if (BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif()
# Generate install
include(GNUInstallDirs)
install(TARGETS lexertl EXPORT lexertlTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
export(EXPORT lexertlTargets
FILE ${CMAKE_BINARY_DIR}/cmake/lexertlTargets.cmake
NAMESPACE lexertl::
)
install(DIRECTORY include/lexertl DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT lexertlTargets
FILE lexertlTargets.cmake
NAMESPACE lexertl::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lexertl
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
${CMAKE_SOURCE_DIR}/cmake/lexertlConfig.cmake.in
${CMAKE_BINARY_DIR}/cmake/lexertlConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lexertl
)
write_basic_package_version_file(
${CMAKE_BINARY_DIR}/cmake/lexertlConfigVersion.cmake
COMPATIBILITY AnyNewerVersion
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/lexertlConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cmake/lexertlConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lexertl
)