-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
88 lines (66 loc) · 2.18 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
cmake_minimum_required(VERSION 3.5)
message(STATUS " CMakeLists: NodeGraph")
option(BUILD_NODEGRAPH_TESTS "Build Tests" OFF)
option(BUILD_NODEGRAPH_APP "Build APP" ON)
# Global Settings
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_DEBUG_POSTFIX "-debug")
set(CMAKE_RELWITHDEBINFO_POSTFIX "-reldbg")
if (WIN32)
set(VCPKG_TARGET_TRIPLET x64-windows-static-md)
endif()
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file")
project(NodeGraph
LANGUAGES CXX C
VERSION 0.5.0
)
include(cmake/utils.cmake)
find_package(SDL2 REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(freetype CONFIG REQUIRED)
set(NODEGRAPH_ROOT ${CMAKE_CURRENT_LIST_DIR})
set(M3RDPARTY_DIR ${CMAKE_CURRENT_LIST_DIR}/m3rdparty)
set(NODEGRAPH_INCLUDE_DIR include/)
configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake/config_nodegraph_app.h.cmake ${CMAKE_BINARY_DIR}/config_nodegraph_app.h)
include(GNUInstallDirs)
include(cmake/all.cmake)
# Library
add_subdirectory(src)
# Support library and app
if (BUILD_NODEGRAPH_APP)
SET(ZING_DIR ${CMAKE_CURRENT_LIST_DIR}/libs/zing)
SET(ZING_LIBRARY_ONLY 1)
add_subdirectory(${ZING_DIR})
add_subdirectory(app)
endif()
# Tests
if (BUILD_NODEGRAPH_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
# Make the CMake bits that ensure find_package does the right thing
#install(EXPORT nodegraph-targets
# FILE nodegraph-targets.cmake
# NAMESPACE NodeGraph::
# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/nodegraph
#)
include(CMakePackageConfigHelpers)
configure_package_config_file(
${NODEGRAPH_ROOT}/cmake/nodegraph-config.cmake.in
${CMAKE_BINARY_DIR}/cmake/nodegraph-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/nodegraph
)
write_basic_package_version_file(
${CMAKE_BINARY_DIR}/cmake/nodegraph-config-version.cmake
VERSION 1.0
COMPATIBILITY AnyNewerVersion
)
install(
FILES
${CMAKE_BINARY_DIR}/cmake/nodegraph-config.cmake
${CMAKE_BINARY_DIR}/cmake/nodegraph-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/nodegraph
)