forked from seanmiddleditch/ezoptionparser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
78 lines (60 loc) · 2.64 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
cmake_minimum_required(VERSION 3.7.2)
set(CMAKE_USE_RELATIVE_PATHS TRUE)
project("ezOptionParser")
set("PROJECT_DESCRIPTION" "An another command-line parser class for C++ that has features not available in alternative solutions (getopt, boost, argtable, argstream, gflags) and doesn't require a steep learning curve.")
set("PROJECT_HOMEPAGE_URL" "https://github.com/makerbot/clp-parser") # also https://sourceforge.net/project/clp-parser
set(CPACK_PACKAGE_VENDOR "Remik Ziemlinski et al.")
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "2")
set(CPACK_PACKAGE_VERSION_PATCH "2")
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(OUR_CMAKE_MODULES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(OUR_CMAKE_3PARTY_MODULES_DIR "${OUR_CMAKE_MODULES_DIR}/thirdParty")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${OUR_CMAKE_MODULES_DIR}" "${OUR_CMAKE_3PARTY_MODULES_DIR}" "${OUR_CMAKE_3PARTY_MODULES_DIR}/Boilerplate" "${OUR_CMAKE_3PARTY_MODULES_DIR}/DoxygenUtils")
include(Boilerplate)
include(DoxygenUtils)
set(Include_dir "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(Examples_Dir "${CMAKE_CURRENT_SOURCE_DIR}/examples")
buildAndPackageLib(${PROJECT_NAME}
TYPE INTERFACE
COMPONENT "lib"
DESCRIPTION "${PROJECT_DESCRIPTION}"
PUBLIC_INCLUDES ${Include_dir}
DO_NOT_PASSTHROUGH
)
option(WITH_EXAMPLES "Build examples" OFF)
if(WITH_EXAMPLES)
file(GLOB_RECURSE EXAMPLES "${Examples_Dir}/*.cpp")
foreach(example ${EXAMPLES})
get_filename_component(exampleName "${example}" NAME_WE)
add_executable("${exampleName}" "${example}")
harden("${exampleName}")
add_sanitizers("${exampleName}")
target_include_directories("${exampleName}" PRIVATE "${Include_dir}")
endforeach()
endif()
option(WITH_DOCS "Build docs" ON)
if(WITH_DOCS)
find_package(Doxygen REQUIRED dot)
load_doxyfile("${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile")
set(DOXYGEN_PROJECT_BRIEF "${CPACK_PACKAGE_DESCRIPTION}")
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE "${CPACK_RESOURCE_FILE_README}")
set("DOXYGEN_GENERATE_HTML" YES)
set("DOXYGEN_GENERATE_MAN" YES)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(STATUS "Compiler is CLang, enabling CLang-assisted parsing in Doxygen.")
set(DOXYGEN_CLANG_ASSISTED_PARSING YES)
set(DOXYGEN_CLANG_OPTIONS "-I${Include_dir}")
endif()
set(DOXYGEN_EXAMPLE_PATH "${Examples_Dir}")
set(DOXYGEN_STRIP_FROM_PATH "${Include_dir}")
set(DOXYGEN_STRIP_FROM_INC_PATH "${Include_dir}")
file(GLOB HEADERS "${Include_dir}/*.h" "${Include_dir}/*.hxx" "${Include_dir}/*.hpp")
doxygen_add_docs(docs
"${HEADERS}"
ALL
USE_STAMP_FILE
)
endif()
#pass_through_cpack_vars()
include(CPack)