forked from CMakePP/CMaize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
40 lines (33 loc) · 1.04 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
cmake_minimum_required(VERSION 3.12)
project(CPP VERSION 0.0.0)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(CMakePackageConfigHelpers)
include(CPPMain)
include(cpp_options)
CPPMain()
cpp_option(BUILD_TESTS TRUE)
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
#These are the names/paths for the generated config files pre-install
set(cpp_config_file ${CMAKE_BINARY_DIR}/cpp-config.cmake)
set(cpp_version_file ${CMAKE_BINARY_DIR}/cpp-config-version.cmake)
#Configure the main config file
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cpp-config.cmake.in
${cpp_config_file}
INSTALL_DESTINATION ${CPP_SHAREDIR}
)
#Configure the version file
write_basic_package_version_file(
${cpp_version_file} COMPATIBILITY SameMajorVersion
)
#Install the submodules
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake/"
DESTINATION ${CPP_SHAREDIR})
#Install the config files
install(
FILES "${cpp_config_file}" "${cpp_version_file}"
DESTINATION ${CPP_SHAREDIR}
)