mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-29 20:23:55 +00:00
Fixing use as a subproject for installing #156
This commit is contained in:
parent
b53eb51603
commit
f16f3c97f0
@ -79,9 +79,17 @@ target_include_directories(CLI11 INTERFACE
|
||||
# Make add_subdirectory work like find_package
|
||||
add_library(CLI11::CLI11 ALIAS CLI11)
|
||||
|
||||
option(CLI11_INSTALL "Install the CLI11 folder to include during install process" ${CUR_PROJ})
|
||||
|
||||
# This folder should be installed
|
||||
if(CLI11_INSTALL)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/CLI DESTINATION include)
|
||||
|
||||
# Make an export target
|
||||
install(TARGETS CLI11
|
||||
EXPORT CLI11Targets)
|
||||
endif()
|
||||
|
||||
# Use find_package on the installed package
|
||||
# Since we have no custom code, we can directly write this
|
||||
# to Config.cmake (otherwise we'd have a custom config and would
|
||||
@ -95,14 +103,12 @@ write_basic_package_version_file(
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
|
||||
# These installs only make sense for a local project
|
||||
if(CUR_PROJ)
|
||||
# Make version available in the install
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/CLI11ConfigVersion.cmake"
|
||||
DESTINATION lib/cmake/CLI11)
|
||||
|
||||
# Make an export target
|
||||
install(TARGETS CLI11
|
||||
EXPORT CLI11Targets)
|
||||
|
||||
# Install the export target as a file
|
||||
install(EXPORT CLI11Targets
|
||||
FILE CLI11Config.cmake
|
||||
@ -116,6 +122,7 @@ export(TARGETS CLI11
|
||||
|
||||
# Register in the user cmake package registry
|
||||
export(PACKAGE CLI11)
|
||||
endif()
|
||||
|
||||
option(CLI11_SINGLE_FILE "Generate a single header file" OFF)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user