-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
86 lines (75 loc) · 2.17 KB
/
CMakeLists.txt
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# CMake build script for ArgsParser Library
#
# Building from source:
# > mkdir build && cd build
# > cmake ..
# > cmake --build .
# Note, to build release configuration on Windows with Visual Studio, use instead
# > cmake --build . --config Release
#
# Testing:
# > ctest -V
#
# Install:
# > cmake --build . --target install
cmake_minimum_required(VERSION 3.5)
project(argsparser CXX)
include(GNUInstallDirs)
enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
# Instructions to build static library
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(
SOURCE_FILES
src/autohelp.cpp
src/container.cpp
src/input_container.cpp
src/parser.cpp
src/token.cpp
src/util.cpp
src/value_wrapper.cpp
)
set(
HEADER_FILES
include/argsparser.h
include/argsparser/autohelp.h
include/argsparser/common.h
include/argsparser/container.h
include/argsparser/input_container.h
include/argsparser/parser.h
include/argsparser/token.h
include/argsparser/typed_input_container.h
include/argsparser/typed_value_wrapper.h
include/argsparser/util.h
include/argsparser/value_wrapper.h
)
set(
PRIVATE_HEADER_FILES
include/argsparser/parserImpl.h
)
set(LIB_NAME argsparser)
add_library(${LIB_NAME} STATIC ${SOURCE_FILES})
set_target_properties(
${LIB_NAME} PROPERTIES
VERSION 1
SOVERSION 1
PUBLIC_HEADER "${HEADER_FILES}"
PRIVATE_HEADER "${PRIVATE_HEADER_FILES}")
target_include_directories(${LIB_NAME} PUBLIC include)
target_include_directories(${LIB_NAME} PUBLIC include/argsparser)
configure_file(ArgsParser.pc.in ArgsParser.pc @ONLY)
install(TARGETS ${LIB_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION include/${LIB_NAME}/static
PUBLIC_HEADER DESTINATION include/${LIB_NAME}
PRIVATE_HEADER DESTINATION include/${LIB_NAME})
# Instructions to build test executable
option(BUILD_ARGSPARSER_TESTS "Build Tests." ON)
if(BUILD_ARGSPARSER_TESTS)
include(test/CMakeTests.cmake)
endif(BUILD_ARGSPARSER_TESTS)
# Instructions to build demo executable
option(BUILD_ARGSPARSER_DEMO "Build Functionality Demo." ON)
if(BUILD_ARGSPARSER_DEMO)
include(demo/CMakeDemo.cmake)
endif(BUILD_ARGSPARSER_DEMO)