-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
94 lines (73 loc) · 2.48 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
cmake_minimum_required(VERSION 3.2)
project(Equirec2Perspec CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
include(GNUInstallDirs)
set(version 0.1.0)
set(PACKAGE_CONFIG_FILENAME "${PROJECT_NAME}Config.cmake")
set(PACKAGE_VERSION_FILENAME "${PROJECT_NAME}ConfigVersion.cmake")
find_package(OpenCV REQUIRED)
if(OpenCV_VERSION_MAJOR EQUAL 4)
add_compile_definitions(OPENCV_VER_4)
endif()
add_library(${PROJECT_NAME} SHARED equirec2perspec.cpp equirec2perspec.h)
target_include_directories(${PROJECT_NAME}
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
target_link_libraries(${PROJECT_NAME} PRIVATE ${OpenCV_LIBS})
target_compile_options(${PROJECT_NAME} PRIVATE -O3)
set_target_properties(${PROJECT_NAME} PROPERTIES
LIBRARY_OUTPUT_NAME equi2pers
)
install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/equirec2perspec
)
install(
EXPORT ${PROJECT_NAME}Targets
FILE ${PROJECT_NAME}Targets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/equirec2perspec
)
# export target file to build-tree
export(
EXPORT ${PROJECT_NAME}Targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}Targets.cmake"
)
# install header files
install(
FILES equirec2perspec.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/equirec2perspec"
)
# package config and version files
include(CMakePackageConfigHelpers)
configure_package_config_file(
"${PACKAGE_CONFIG_FILENAME}.in"
"${PROJECT_BINARY_DIR}/cmake/${PACKAGE_CONFIG_FILENAME}"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/equirec2perspec"
)
set_property(TARGET ${PROJECT_NAME} PROPERTY VERSION ${version})
set_property(TARGET ${PROJECT_NAME} PROPERTY SOVERSION 0)
set_property(TARGET ${PROJECT_NAME} PROPERTY
INTERFACE_${PROJECT_NAME}_MAJOR_VERSION 0)
set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY
COMPATIBLE_INTERFACE_STRING ${PROJECT_NAME}_MAJOR_VERSION
)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/cmake/${PACKAGE_VERSION_FILENAME}"
VERSION "${version}"
COMPATIBILITY AnyNewerVersion
)
install(
FILES
"${PROJECT_BINARY_DIR}/cmake/${PACKAGE_CONFIG_FILENAME}"
"${PROJECT_BINARY_DIR}/cmake/${PACKAGE_VERSION_FILENAME}"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/equirec2perspec"
)
# an example program
add_subdirectory(example)