mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-03 22:54:39 +00:00
Set argparse to not run tests or set up install if not top level
This commit is contained in:
parent
e4d4f67a44
commit
e6d2628723
@ -1,5 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.12.4)
|
||||
|
||||
if(NOT DEFINED PROJECT_NAME)
|
||||
set(ARGPARSE_IS_TOP_LEVEL ON)
|
||||
else()
|
||||
set(ARGPARSE_IS_TOP_LEVEL OFF)
|
||||
endif()
|
||||
|
||||
project(argparse
|
||||
VERSION 2.9.0
|
||||
DESCRIPTION "A single header argument parser for C++17"
|
||||
@ -9,6 +15,7 @@ project(argparse
|
||||
|
||||
option(ARGPARSE_INSTALL "Include an install target" ON)
|
||||
option(ARGPARSE_BUILD_TESTS "Build tests" ON)
|
||||
option(ARGPARSE_BUILD_SAMPLES "Build samples" OFF)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(CMakePackageConfigHelpers)
|
||||
@ -24,12 +31,12 @@ target_include_directories(argparse INTERFACE
|
||||
if(ARGPARSE_BUILD_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(ARGPARSE_BUILD_TESTS)
|
||||
|
||||
if(ARGPARSE_BUILD_TESTS AND ARGPARSE_IS_TOP_LEVEL)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
if(ARGPARSE_INSTALL)
|
||||
|
||||
if(ARGPARSE_INSTALL AND ARGPARSE_IS_TOP_LEVEL)
|
||||
install(TARGETS argparse EXPORT argparseConfig)
|
||||
install(EXPORT argparseConfig
|
||||
NAMESPACE argparse::
|
||||
|
@ -1179,8 +1179,6 @@ PROJECT(myproject)
|
||||
|
||||
# fetch latest argparse
|
||||
include(FetchContent)
|
||||
set(ARGPARSE_BUILD_TESTS OFF CACHE INTERNAL "Turn off building argparse tests")
|
||||
set(ARGPARSE_BUILD_SAMPLES OFF CACHE INTERNAL "Turn off building argparse samples")
|
||||
FetchContent_Declare(
|
||||
argparse
|
||||
GIT_REPOSITORY https://github.com/p-ranav/argparse.git
|
||||
|
Loading…
Reference in New Issue
Block a user