mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 07:04: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)
|
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
|
project(argparse
|
||||||
VERSION 2.9.0
|
VERSION 2.9.0
|
||||||
DESCRIPTION "A single header argument parser for C++17"
|
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_INSTALL "Include an install target" ON)
|
||||||
option(ARGPARSE_BUILD_TESTS "Build tests" ON)
|
option(ARGPARSE_BUILD_TESTS "Build tests" ON)
|
||||||
|
option(ARGPARSE_BUILD_SAMPLES "Build samples" OFF)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
@ -25,11 +32,11 @@ if(ARGPARSE_BUILD_SAMPLES)
|
|||||||
add_subdirectory(samples)
|
add_subdirectory(samples)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ARGPARSE_BUILD_TESTS)
|
if(ARGPARSE_BUILD_TESTS AND ARGPARSE_IS_TOP_LEVEL)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ARGPARSE_INSTALL)
|
if(ARGPARSE_INSTALL AND ARGPARSE_IS_TOP_LEVEL)
|
||||||
install(TARGETS argparse EXPORT argparseConfig)
|
install(TARGETS argparse EXPORT argparseConfig)
|
||||||
install(EXPORT argparseConfig
|
install(EXPORT argparseConfig
|
||||||
NAMESPACE argparse::
|
NAMESPACE argparse::
|
||||||
|
@ -1179,8 +1179,6 @@ PROJECT(myproject)
|
|||||||
|
|
||||||
# fetch latest argparse
|
# fetch latest argparse
|
||||||
include(FetchContent)
|
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(
|
FetchContent_Declare(
|
||||||
argparse
|
argparse
|
||||||
GIT_REPOSITORY https://github.com/p-ranav/argparse.git
|
GIT_REPOSITORY https://github.com/p-ranav/argparse.git
|
||||||
|
Loading…
Reference in New Issue
Block a user