Update CMakeLists.txt

Added ARGPARSE_INSTALL
This allows a separate project using argparse through CMake FetchContent_Declare(...) to install the project without having to also install argparse.
This commit is contained in:
BryanFlynt 2022-11-05 15:45:17 -06:00 committed by GitHub
parent 6960571156
commit 764442f0f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ project(argparse
LANGUAGES CXX LANGUAGES CXX
) )
option(ARGPARSE_INSTALL OFF)
option(ARGPARSE_BUILD_TESTS OFF) option(ARGPARSE_BUILD_TESTS OFF)
option(ARGPARSE_LONG_VERSION_ARG_ONLY OFF) option(ARGPARSE_LONG_VERSION_ARG_ONLY OFF)
@ -36,6 +37,7 @@ if(ARGPARSE_BUILD_TESTS)
add_subdirectory(test) add_subdirectory(test)
endif() endif()
if(ARGPARSE_INSTALL)
install(TARGETS argparse EXPORT argparseConfig) install(TARGETS argparse EXPORT argparseConfig)
install(EXPORT argparseConfig install(EXPORT argparseConfig
NAMESPACE argparse:: NAMESPACE argparse::
@ -94,5 +96,6 @@ configure_file("${PackagingTemplatesDir}/pkgconfig.pc.in" "${PKG_CONFIG_FILE_NAM
install(FILES "${PKG_CONFIG_FILE_NAME}" install(FILES "${PKG_CONFIG_FILE_NAME}"
DESTINATION "${CMAKE_INSTALL_LIBDIR_ARCHIND}/pkgconfig" DESTINATION "${CMAKE_INSTALL_LIBDIR_ARCHIND}/pkgconfig"
) )
endif()
include(CPack) include(CPack)