mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-12-16 03:08:52 +08:00
Merge pull request #185 from ax3l/topic-installEmbed
CMake: Optional Install if Embedded
This commit is contained in:
@@ -4,6 +4,7 @@ enable_testing()
|
|||||||
project(toml11 VERSION 3.7.0)
|
project(toml11 VERSION 3.7.0)
|
||||||
|
|
||||||
option(toml11_BUILD_TEST "Build toml tests" OFF)
|
option(toml11_BUILD_TEST "Build toml tests" OFF)
|
||||||
|
option(toml11_INSTALL "Install CMake targets during install step." ON)
|
||||||
option(toml11_TEST_WITH_ASAN "use LLVM address sanitizer" OFF)
|
option(toml11_TEST_WITH_ASAN "use LLVM address sanitizer" OFF)
|
||||||
option(toml11_TEST_WITH_UBSAN "use LLVM undefined behavior sanitizer" OFF)
|
option(toml11_TEST_WITH_UBSAN "use LLVM undefined behavior sanitizer" OFF)
|
||||||
|
|
||||||
@@ -75,38 +76,40 @@ write_basic_package_version_file(
|
|||||||
COMPATIBILITY SameMajorVersion
|
COMPATIBILITY SameMajorVersion
|
||||||
)
|
)
|
||||||
|
|
||||||
configure_package_config_file(
|
if (toml11_INSTALL)
|
||||||
cmake/toml11Config.cmake.in
|
configure_package_config_file(
|
||||||
${toml11_config}
|
cmake/toml11Config.cmake.in
|
||||||
INSTALL_DESTINATION ${toml11_install_cmake_dir}
|
${toml11_config}
|
||||||
PATH_VARS toml11_install_cmake_dir
|
INSTALL_DESTINATION ${toml11_install_cmake_dir}
|
||||||
)
|
PATH_VARS toml11_install_cmake_dir
|
||||||
|
)
|
||||||
|
|
||||||
# Install config files
|
# Install config files
|
||||||
install(FILES ${toml11_config} ${toml11_config_version}
|
install(FILES ${toml11_config} ${toml11_config_version}
|
||||||
DESTINATION ${toml11_install_cmake_dir}
|
DESTINATION ${toml11_install_cmake_dir}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Install header files
|
# Install header files
|
||||||
install(
|
install(
|
||||||
FILES toml.hpp
|
FILES toml.hpp
|
||||||
DESTINATION "${toml11_install_include_dir}"
|
DESTINATION "${toml11_install_include_dir}"
|
||||||
)
|
)
|
||||||
install(
|
install(
|
||||||
DIRECTORY "toml"
|
DIRECTORY "toml"
|
||||||
DESTINATION "${toml11_install_include_dir}"
|
DESTINATION "${toml11_install_include_dir}"
|
||||||
FILES_MATCHING PATTERN "*.hpp"
|
FILES_MATCHING PATTERN "*.hpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Export targets and install them
|
# Export targets and install them
|
||||||
install(TARGETS toml11
|
install(TARGETS toml11
|
||||||
EXPORT toml11Targets
|
EXPORT toml11Targets
|
||||||
)
|
)
|
||||||
install(EXPORT toml11Targets
|
install(EXPORT toml11Targets
|
||||||
FILE toml11Targets.cmake
|
FILE toml11Targets.cmake
|
||||||
DESTINATION ${toml11_install_cmake_dir}
|
DESTINATION ${toml11_install_cmake_dir}
|
||||||
NAMESPACE toml11::
|
NAMESPACE toml11::
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (toml11_BUILD_TEST)
|
if (toml11_BUILD_TEST)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|||||||
Reference in New Issue
Block a user