Skip to content

Commit

Permalink
Merge pull request #364 from zhao-shihan/master
Browse files Browse the repository at this point in the history
Allow to install when argparse is a subproject
  • Loading branch information
p-ranav authored Jun 15, 2024
2 parents e462ab9 + 16d0e56 commit a2b4d27
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ project(argparse
LANGUAGES CXX
)

option(ARGPARSE_INSTALL "Include an install target" ON)
option(ARGPARSE_BUILD_TESTS "Build tests" ON)
option(ARGPARSE_INSTALL "Include an install target" ${ARGPARSE_IS_TOP_LEVEL})
option(ARGPARSE_BUILD_TESTS "Build tests" ${ARGPARSE_IS_TOP_LEVEL})
option(ARGPARSE_BUILD_SAMPLES "Build samples" OFF)

include(GNUInstallDirs)
Expand All @@ -32,11 +32,11 @@ if(ARGPARSE_BUILD_SAMPLES)
add_subdirectory(samples)
endif()

if(ARGPARSE_BUILD_TESTS AND ARGPARSE_IS_TOP_LEVEL)
if(ARGPARSE_BUILD_TESTS)
add_subdirectory(test)
endif()

if(ARGPARSE_INSTALL AND ARGPARSE_IS_TOP_LEVEL)
if(ARGPARSE_INSTALL)
install(TARGETS argparse EXPORT argparseConfig)
install(EXPORT argparseConfig
NAMESPACE argparse::
Expand Down

0 comments on commit a2b4d27

Please sign in to comment.