-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
70 lines (58 loc) · 1.87 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
cmake_minimum_required(VERSION 3.13)
get_directory_property(is_subproject PARENT_DIRECTORY)
if(is_subproject)
message(STATUS "aeh: Building as subproject")
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/submodules/build-utils/cmake")
if (NOT is_subproject)
include(static-msvc-runtime)
set_old_msvc_runtime_policy()
endif()
project(aeh CXX)
if (NOT is_subproject)
set_static_msvc_runtime()
include(set-globals)
include(set-link-time-optimization)
endif()
option(AEH_WITH_SDL2 "Build components depending on SDL2" ON)
option(AEH_WITH_IMGUI "Build components depending on Dear ImGui" ON)
option(AEH_WITH_GLM "Build components depending on GLM" ON)
option(AEH_BUILD_TESTS "Build unit-tests" ON)
if (AEH_WITH_IMGUI AND NOT AEH_WITH_IMGUI)
message(FATAL_ERROR "Dear ImGui depends on SDL2")
endif()
if (CONAN_EXPORTED) # Running from conan, building a package
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
else() # Development, running directly from cmake
include(conan-run)
if (NOT is_subproject)
set(CMAKE_CONFIGURATION_TYPES Debug Release)
endif()
set(conan_options)
add_conan_bool_option_to_list(conan_options ${AEH_WITH_SDL2} "with_sdl2")
add_conan_bool_option_to_list(conan_options ${AEH_WITH_IMGUI} "with_imgui")
add_conan_bool_option_to_list(conan_options ${AEH_WITH_GLM} "with_glm")
add_conan_bool_option_to_list(conan_options ${AEH_BUILD_TESTS} "with_unit_tests")
conan_run(
OPTIONS
${conan_options}
EXTRA_SETTINGS
"compiler.cppstd=20"
)
endif()
if (NOT is_subproject)
option(TREAT_WARNINGS_AS_ERRORS "Treat warnings as errors" TRUE)
if (TREAT_WARNINGS_AS_ERRORS)
include(warnings-as-errors)
add_warnings_as_errors()
endif()
include(common-flags)
add_common_flags()
endif()
install(FILES "LICENSE.txt" DESTINATION ".")
add_subdirectory(aeh)
if (AEH_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()