-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
51 lines (42 loc) · 1.22 KB
/
Copy pathCMakeLists.txt
File metadata and controls
51 lines (42 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
cmake_minimum_required(VERSION 3.15)
project(
argparse
VERSION "0.1"
LANGUAGES CXX)
set("PROJECT_DESCRIPTION"
"A header-only lightweight C++ command line option parser")
set("PROJECT_HOMEPAGE_URL" "https://github.com/shediao/argparse.hpp")
# PROJECT_IS_TOP_LEVEL
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
option(ARGPARSE_BUILD_TESTS "Set to ON to build tests" ON)
else()
option(ARGPARSE_BUILD_TESTS "Set to OFF to build tests" OFF)
endif()
add_library(argparse INTERFACE)
target_include_directories(
argparse INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(argparse INTERFACE cxx_std_20)
add_library(argparse::argparse ALIAS argparse)
if(ARGPARSE_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
# PROJECT_IS_TOP_LEVEL
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
install(
TARGETS argparse
EXPORT argparse-targets
INCLUDES
DESTINATION include)
install(
DIRECTORY include/
DESTINATION include
FILES_MATCHING
PATTERN "*.hpp")
install(
EXPORT argparse-targets
FILE argparse-targets.cmake
NAMESPACE argparse::
DESTINATION lib/cmake/argparse)
endif()