-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCMakeLists.txt
56 lines (51 loc) · 1.56 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
cmake_minimum_required(VERSION 3.11)
project(pntr
DESCRIPTION "pntr: Paint the things"
HOMEPAGE_URL "https://github.com/robloach/pntr"
VERSION 0.0.1
LANGUAGES C
)
# pntr
add_library(pntr INTERFACE)
target_include_directories(pntr INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
# Options
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
set(PNTR_IS_MAIN TRUE)
else()
set(PNTR_IS_MAIN FALSE)
endif()
# Examples
option(PNTR_BUILD_EXAMPLES "Examples" ${PNTR_IS_MAIN})
if (PNTR_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
# Tests
option(PNTR_BUILD_TESTS "Build Tests" ${PNTR_IS_MAIN})
if (PNTR_BUILD_TESTS)
include(CTest)
enable_testing()
if (BUILD_TESTING)
set(CTEST_CUSTOM_TESTS_IGNORE
pkg-config--static
)
# Always print verbose output when tests fail if run using `make test`.
list(APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure -V --debug")
add_subdirectory(test)
endif()
endif()
# Documentation
option(PNTR_BUILD_DOCS "Build Documentation" OFF)
if (PNTR_BUILD_EXAMPLES AND PNTR_BUILD_DOCS)
find_package(Doxygen)
if (DOXYGEN_FOUND)
add_custom_target(pntr_doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/.Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM
DEPENDS pntr_examples_output
)
else (DOXYGEN_FOUND)
message("Doxygen is required to build documentation")
endif (DOXYGEN_FOUND)
endif()