-
Notifications
You must be signed in to change notification settings - Fork 47
/
CMakeLists.txt
93 lines (76 loc) · 2.27 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
cmake_minimum_required(VERSION 3.15)
project(FFGL-SDK
VERSION 2.2
LANGUAGES CXX
)
# resolve dependencies if using vcpkg
if (EXISTS CACHE{VCPKG_MANIFEST_FILE})
vcpkg_acquire_dependencies()
endif()
add_library(ffgl-sdk STATIC
source/lib/FFGLSDK.h
source/lib/FFGLSDK.cpp
)
add_library(ffgl::sdk ALIAS ffgl-sdk)
set_target_properties(ffgl-sdk PROPERTIES EXPORT_NAME sdk)
target_include_directories(ffgl-sdk PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/source/lib/>
$<INSTALL_INTERFACE:include>
)
target_compile_features(ffgl-sdk PUBLIC cxx_std_11)
# we need glew (except on macOS)
if (NOT APPLE)
find_package(GLEW REQUIRED)
target_link_libraries(ffgl-sdk PRIVATE GLEW::GLEW)
endif()
include(GNUInstallDirs)
install(
DIRECTORY source/lib/ffgl
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
)
install(
TARGETS ffgl-sdk
EXPORT ffgl-sdk-targets
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(
EXPORT ffgl-sdk-targets
NAMESPACE ffgl::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ffgl-sdk
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/ffgl-sdk/ffgl-sdk-config-version.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
export(
EXPORT ffgl-sdk-targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/ffgl-sdk/ffgl-sdk-targets.cmake"
NAMESPACE ffgl::
)
configure_file(cmake/ffgl-sdk-config.cmake
"${CMAKE_CURRENT_BINARY_DIR}/ffgl-sdk/ffgl-sdk-config-version.cmake"
COPYONLY
)
install(
FILES
cmake/ffgl-sdk-config.cmake
"${CMAKE_CURRENT_BINARY_DIR}/ffgl-sdk/ffgl-sdk-config-version.cmake"
DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake/ffgl-sdk
)
# are we building ffgl as the main repo, or is it included
# into another project?
set(FFGL_MASTER_PROJECT OFF)
if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
set(FFGL_MASTER_PROJECT ON)
endif()
# should we build the example plugins? we do this by default
# if building the project directly, but not when adding ffgl
# to another project
option(FFGL_BUILD_EXAMPLE_PLUGINS ${FFGL_MASTER_PROJECT} "Build the example FFGL plugins")
if (${FFGL_BUILD_EXAMPLE_PLUGINS})
add_subdirectory(source/plugins)
endif()