-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
103 lines (77 loc) · 2.69 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
cmake_minimum_required(VERSION 3.8)
if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(
co_ecs
VERSION 0.9.0
DESCRIPTION "Cobalt ECS"
LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include(FetchContent)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME}
INTERFACE $<BUILD_INTERFACE:${${PROJECT_NAME}_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
option(CO_ECS_USE_RANGE_V3 "Use range-v3" OFF)
if(CO_ECS_USE_RANGE_V3)
FetchContent_Declare(
range-v3
GIT_REPOSITORY https://github.com/ericniebler/range-v3
GIT_TAG 0.12.0
)
FetchContent_MakeAvailable(range-v3)
target_link_libraries(${PROJECT_NAME} INTERFACE range-v3)
target_compile_definitions(${PROJECT_NAME} INTERFACE CO_ECS_USE_RANGE_V3)
endif()
option(CO_ECS_ENABLE_DOCS "Enable documentation build" OFF)
if(CO_ECS_ENABLE_DOCS)
find_package(Doxygen)
if(Doxygen_FOUND)
add_subdirectory(docs)
else()
message(STATUS "Doxygen not found, not building docs")
endif()
endif()
option(CO_ECS_ENABLE_EXAMPLES "Enable examples build" OFF)
if(CO_ECS_ENABLE_EXAMPLES)
add_subdirectory(examples)
endif()
option(CO_ECS_ENABLE_TESTING "Enable tests" OFF)
if(CO_ECS_ENABLE_TESTING)
enable_testing()
add_subdirectory(tests)
endif()
option(CO_ECS_ENABLE_BENCHMARKS "Enable benchmakrs" OFF)
if(CO_ECS_ENABLE_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
# locations are provided by GNUInstallDirs
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}_Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
install(EXPORT ${PROJECT_NAME}_Targets
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/co_ecs DESTINATION include)
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
include(CPack)