-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
80 lines (65 loc) · 1.94 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
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree build. Please create a build directory outside of the source code and call cmake from there")
endif ()
cmake_minimum_required(VERSION 3.9)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
##! Project
project(claws)
##! Prerequisites CTEST
enable_testing()
##! Project options
option(CLAWS_BUILD_TESTS "Build claws tests" ON)
option(CLAWS_BUILD_EXAMPLES "Build claws examples" OFF)
option(IDE_BUILD "Workaround for header-only libraries, put it to ON if you use CLION" OFF)
##! CMake Path
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(library)
##! Project modules
add_subdirectory(modules)
##! Project tests
if (CLAWS_BUILD_TESTS)
add_subdirectory(tests)
endif ()
##! Project examples
if (CLAWS_BUILD_EXAMPLES)
add_subdirectory(examples)
endif ()
##! Main library
add_library(claws INTERFACE)
target_link_libraries(claws INTERFACE
claws::utils
claws::container
claws::iterator
claws::algorithm
)
if (NOT IDE_BUILD)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
install(TARGETS
claws
EXPORT claws-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/modules
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/claws
FILES_MATCHING PATTERN "*.h*"
)
install(EXPORT claws-targets
FILE claws-targets.cmake
NAMESPACE claws::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/claws
)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/claws-config.cmake.in"
"${PROJECT_BINARY_DIR}/claws-config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/claws
)
install(FILES
"${PROJECT_BINARY_DIR}/claws-config.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/claws)
endif()