-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
120 lines (100 loc) · 3.5 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
cmake_minimum_required(VERSION 3.15)
# Set the project name to your project name, my project isn't very descriptive
project(Tutorial VERSION 1.0 LANGUAGES CXX)
include(cmake/StandardProjectSettings.cmake)
include(cmake/PreventInSourceBuilds.cmake)
# Link this 'library' to set the c++ standard / compile-time options requested
add_library(project_options INTERFACE)
target_compile_features(project_options INTERFACE cxx_std_20)
# Link this 'library' to use the warnings specified in CompilerWarnings.cmake
add_library(project_warnings INTERFACE)
# iwyu
#include(cmake/Iwyu.cmake)
# enable cache system
#include(cmake/Cache.cmake)
# standard compiler warnings
include(cmake/CompilerWarnings.cmake)
set_project_warnings(project_warnings)
# sanitizer options if supported by compiler
include(cmake/Sanitizers.cmake)
enable_sanitizers(project_options)
# enable doxygen
include(cmake/Doxygen.cmake)
enable_doxygen()
# allow for static analysis options
include(cmake/StaticAnalyzers.cmake)
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
option(ENABLE_TESTING "Enable Test Builds" OFF)
find_package(Threads REQUIRED)
add_subdirectory(include)
option(ENABLE_UNITY "Enable Unity builds of projects" OFF)
if(ENABLE_UNITY)
# Add for any project you want to apply unity builds for
set_target_properties(game24 PROPERTIES UNITY_BUILD ON)
endif()
# control where the static and shared libraries are built so that on windows
# we don't need to tinker with the path to run the executable
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
if(APPLE)
set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
elseif(UNIX)
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
endif()
# add the MathFunctions library
#add_subdirectory(MathFunctions)
#add_subdirectory(TutorialDir)
#
#
## add the install targets
#install(TARGETS Tutorial DESTINATION bin)
#install(FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h"
# DESTINATION include
# )
#
## enable testing
if(ENABLE_TESTING)
add_subdirectory(test)
endif()
#enable_testing()
## set(VCPKG_ROOT "/home/rob/openSrc/vcpkg")
#
#include(InstallRequiredSystemLibraries)
#set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
#set(CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}")
#set(CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}")
#include(CPack)
#
## install the configuration targets
#install(EXPORT MathFunctionsTargets
# FILE MathFunctionsTargets.cmake
# DESTINATION lib/cmake/MathFunctions
#)
#
#include(CMakePackageConfigHelpers)
## generate the config file that is includes the exports
#configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
# "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake"
# INSTALL_DESTINATION "lib/cmake/example"
# NO_SET_AND_CHECK_MACRO
# NO_CHECK_REQUIRED_COMPONENTS_MACRO
# )
## generate the version file for the config file
#write_basic_package_version_file(
# "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfigVersion.cmake"
# VERSION "${Tutorial_VERSION_MAJOR}.${Tutorial_VERSION_MINOR}"
# COMPATIBILITY AnyNewerVersion
#)
#
## install the configuration file
#install(FILES
# ${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake
# DESTINATION lib/cmake/MathFunctions
# )
#
## generate the export targets for the build tree
## needs to be after the install(TARGETS ) command
#export(EXPORT MathFunctionsTargets
# FILE "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsTargets.cmake"
#)