-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
101 lines (84 loc) · 3.56 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
cmake_minimum_required(VERSION 3.19)
project(Navigator VERSION 0.3.0 LANGUAGES C CXX)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
include(GNUInstallDirs) # for CMAKE_INSTALL_LIBDIR and so on
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_EXTENSIONS False)
option(LABCAMERA_IMGUI "Build LabCamera DearImgui binding" OFF)
option(LABCAMERA_EXAMPLES "Build LabCamera examples" OFF)
set(LABCAMERA_IMGUI_PATH "examples/Navigator/third/imgui" CACHE FILEPATH "path to Dear ImGui")
configure_file(cpp/LabCameraVersion.h.in LabCameraVersion.h)
set(LABCAMERA_PUBLIC_H cpp/include/LabCamera/LabCamera.h)
add_library(LabCamera STATIC ${LABCAMERA_PUBLIC_H} cpp/LabCamera.cpp)
target_include_directories(LabCamera
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cpp/include>
$<INSTALL_INTERFACE:include>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/cpp/include
)
set_target_properties(LabCamera PROPERTIES
FOLDER "LabCamera"
POSITION_INDEPENDENT_CODE ON
PUBLIC_HEADER "${LABCAMERA_PUBLIC_H}"
OUTPUT_NAME "LabCamera"
OUTPUT_NAME_DEBUG "LabCamera_d"
)
set(LABCAMERA_INSTALLABLE LabCamera)
configure_file(LabCameraConfig.cmake.in "${PROJECT_BINARY_DIR}/LabCameraConfig.cmake" @ONLY)
add_library(Lab::LabCamera ALIAS LabCamera)
if (LABCAMERA_IMGUI OR LABCAMERA_EXAMPLES)
set(LABCAMERA_IMGUI_PUBLIC_H cpp/include/LabCamera/LabCameraImGui.h)
add_library(LabCameraImGui STATIC ${LABCAMERA_IMGUI_PUBLIC_H} cpp/LabCameraImGui.cpp)
target_include_directories(LabCameraImGui
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cpp/include ${LABCAMERA_IMGUI_PATH}>
$<INSTALL_INTERFACE:include}>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/cpp/include ${LABCAMERA_IMGUI_PATH}
)
set_target_properties(LabCameraImGui PROPERTIES
FOLDER "LabCameraImGui"
POSITION_INDEPENDENT_CODE ON
PUBLIC_HEADER "${LABCAMERA_IMGUI_PUBLIC_H}"
OUTPUT_NAME "LabCameraImGui"
OUTPUT_NAME_DEBUG "LabCameraImGui_d"
)
list(APPEND LABCAMERA_INSTALLABLE LabCameraImGui)
add_library(Lab::LabCameraImGui ALIAS LabCameraImGui)
endif()
install(
TARGETS ${LABCAMERA_INSTALLABLE}
EXPORT LabCameraTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_PREFIX}/include/LabCamera"
)
install(EXPORT LabCameraTargets
FILE LabCameraTargets.cmake
NAMESPACE Lab::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/LabCamera")
include(CMakePackageConfigHelpers)
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/LabCameraConfigVersion.cmake"
VERSION "${LabCamera_VERSION_MAJOR}.${LabCamera_VERSION_MINOR}"
COMPATIBILITY AnyNewerVersion)
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/LabCameraConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/LabCameraConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/LabCamera"
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
install(FILES
"${PROJECT_BINARY_DIR}/LabCameraVersion.h" DESTINATION "${CMAKE_INSTALL_PREFIX}/include/LabCamera")
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/LabCameraConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/LabCameraConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/LabCamera")
export(EXPORT LabCameraTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/LabCameraTargets.cmake"
NAMESPACE Lab::
)
if (LABCAMERA_EXAMPLES)
add_subdirectory(examples/Navigator)
endif()