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,8 +79,16 @@ target_include_directories(CLI11 INTERFACE
|
|||||||
# Make add_subdirectory work like find_package
|
# Make add_subdirectory work like find_package
|
||||||
add_library(CLI11::CLI11 ALIAS CLI11)
|
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
|
# This folder should be installed
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/CLI DESTINATION include)
|
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
|
# Use find_package on the installed package
|
||||||
# Since we have no custom code, we can directly write this
|
# Since we have no custom code, we can directly write this
|
||||||
@ -95,27 +103,26 @@ write_basic_package_version_file(
|
|||||||
COMPATIBILITY AnyNewerVersion
|
COMPATIBILITY AnyNewerVersion
|
||||||
)
|
)
|
||||||
|
|
||||||
# Make version available in the install
|
# These installs only make sense for a local project
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/CLI11ConfigVersion.cmake"
|
if(CUR_PROJ)
|
||||||
DESTINATION lib/cmake/CLI11)
|
# Make version available in the install
|
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/CLI11ConfigVersion.cmake"
|
||||||
|
DESTINATION lib/cmake/CLI11)
|
||||||
|
|
||||||
# Make an export target
|
# Install the export target as a file
|
||||||
install(TARGETS CLI11
|
install(EXPORT CLI11Targets
|
||||||
EXPORT CLI11Targets)
|
FILE CLI11Config.cmake
|
||||||
|
NAMESPACE CLI11::
|
||||||
|
DESTINATION lib/cmake/CLI11)
|
||||||
|
|
||||||
# Install the export target as a file
|
# Use find_package on the installed package
|
||||||
install(EXPORT CLI11Targets
|
export(TARGETS CLI11
|
||||||
FILE CLI11Config.cmake
|
NAMESPACE CLI11::
|
||||||
NAMESPACE CLI11::
|
FILE CLI11Targets.cmake)
|
||||||
DESTINATION lib/cmake/CLI11)
|
|
||||||
|
|
||||||
# Use find_package on the installed package
|
# Register in the user cmake package registry
|
||||||
export(TARGETS CLI11
|
export(PACKAGE CLI11)
|
||||||
NAMESPACE CLI11::
|
endif()
|
||||||
FILE CLI11Targets.cmake)
|
|
||||||
|
|
||||||
# Register in the user cmake package registry
|
|
||||||
export(PACKAGE CLI11)
|
|
||||||
|
|
||||||
option(CLI11_SINGLE_FILE "Generate a single header file" OFF)
|
option(CLI11_SINGLE_FILE "Generate a single header file" OFF)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user