-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
58 lines (43 loc) · 2 KB
/
CMakeLists.txt
File metadata and controls
58 lines (43 loc) · 2 KB
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
cmake_minimum_required(VERSION 3.19.2)
project(Tree_class_for_cpp CXX)
add_subdirectory(extern/json)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ")
endif()
set(CMAKE_CXX_STANDARD 20 CACHE STRING "CMAKE_CXX_STANDARD")
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "CMAKE_CONFIGURATION_TYPES")
set(CMAKE_INSTALL_PREFIX "C:/Program Files/${PROJECT_NAME}" CACHE PATH "CMAKE_INSTALL_PREFIX ")
enable_testing()
add_definitions(-DCMAKE_BINARY_DIR="${CMAKE_BINARY_DIR}")
if(MSVC)
add_compile_options(/ZI)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL")
endif()
add_library(lib INTERFACE)
target_include_directories(lib INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/lib)
target_include_directories(lib INTERFACE $<TARGET_PROPERTY:nlohmann_json::nlohmann_json,INTERFACE_INCLUDE_DIRECTORIES>)
# Example glfw app just tested for windows!
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux" AND (NOT DEFINED ENV{DISPLAY} OR "$ENV{TERM}" STREQUAL "linux"))
message(STATUS "No X Windows System on Linux.")
else()
# Set this to point to an up-to-date GLFW repo.
set(GLFW_DIR "${PROJECT_SOURCE_DIR}/../glfw")
# Set this to point to an up-to-date imgui repo.
set(IMGUI_DIR "${PROJECT_SOURCE_DIR}/../imgui")
find_package(Vulkan)
if(EXISTS ${GLFW_DIR} AND EXISTS ${IMGUI_DIR} AND ${Vulkan_FOUND})
add_subdirectory(src bin)
else()
if(NOT EXISTS ${GLFW_DIR})
message(WARNING "GLFW not repository found: ${GLFW_DIR}")
endif()
if(NOT EXISTS ${IMGUI_DIR})
message(WARNING "Imgui not repository found: ${IMGUI_DIR}")
endif()
if(NOT ${Vulkan_FOUND})
message(WARNING "Vulkan not found. Install it!")
endif()
endif()
endif()
add_subdirectory(test)
file(COPY ${CMAKE_SOURCE_DIR}/test_data DESTINATION ${CMAKE_BINARY_DIR})