-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
110 lines (93 loc) · 3.89 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
100
101
102
103
104
105
106
107
108
109
110
# This file is automatically generated. Do not modify!
cmake_minimum_required(VERSION 3.10)
project(gz_math_vendor)
# Project-specific settings
set(LIB_VER_MAJOR 8)
set(LIB_VER_MINOR 1)
set(LIB_VER_PATCH 0)
set(LIB_VER_SUFFIX "")
# Derived variables
set(LIB_NAME gz-math)
set(GITHUB_NAME gz-math)
string(REPLACE "-" "_" LIB_NAME_UNDERSCORE ${LIB_NAME})
set(LIB_NAME_COMP_PREFIX ${LIB_NAME})
set(LIB_NAME_FULL ${LIB_NAME}${LIB_VER_MAJOR})
set(LIB_VER ${LIB_VER_MAJOR}.${LIB_VER_MINOR}.${LIB_VER_PATCH})
find_package(ament_cmake_core REQUIRED)
find_package(ament_cmake_vendor_package REQUIRED)
find_package(ament_cmake_export_dependencies REQUIRED)
find_package(gz_cmake_vendor REQUIRED)
find_package(gz_utils_vendor REQUIRED)
# Set the VERSION_MATCH to "EXACT" by default, but relax the requirement
# if we are users are building from source (determined by the
# GZ_BUILD_FROM_SOURCE environment variable) or if explicitly told to do so
# by the GZ_RELAX_VERSION_MATCH environment variable.
set(VERSION_MATCH "EXACT")
if(NOT $ENV{GZ_BUILD_FROM_SOURCE} STREQUAL "")
set(VERSION_MATCH "")
endif()
if(NOT $ENV{GZ_RELAX_VERSION_MATCH} STREQUAL "")
set(VERSION_MATCH "")
endif()
find_package(${LIB_NAME_FULL} ${VERSION_MATCH} ${LIB_VER} COMPONENTS all QUIET)
ament_vendor(${LIB_NAME_UNDERSCORE}_vendor
SATISFIED ${${LIB_NAME_FULL}_FOUND}
VCS_URL https://github.com/gazebosim/${GITHUB_NAME}.git
VCS_VERSION ${GITHUB_NAME}${LIB_VER_MAJOR}_${LIB_VER}${LIB_VER_SUFFIX}
CMAKE_ARGS
-DSKIP_PYBIND11:BOOL=ON
-DSKIP_SWIG:BOOL=ON
GLOBAL_HOOK
)
find_package(ament_cmake_test REQUIRED)
if(BUILD_TESTING)
find_package(ament_cmake_lint_cmake REQUIRED)
find_package(ament_cmake_copyright REQUIRED)
find_package(ament_cmake_xmllint REQUIRED)
ament_lint_cmake()
ament_copyright()
ament_xmllint()
endif()
ament_export_dependencies(
gz_cmake_vendor
gz_utils_vendor
)
if(NOT ${${LIB_NAME_FULL}_FOUND})
ament_environment_hooks("${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.dsv.in")
# Create a dummy .sh file needed for ament_package to source the .dsv file.
# See https://github.com/ament/ament_package/issues/145
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.sh "# Dummy .sh file needed for .dsv file to be sourced.")
ament_environment_hooks("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.sh")
endif()
# The goal is to support versionless package names once the user has found the
# vendor package. Example usage:
#
# find_package(gz_sim_vendor)
# find_package(gz-sim VERSION 8.2.0) # Note gz-sim not gz-sim8
#
# To accomplish this, we create a `{LIB_NAME}-config.cmake` file that does
# find_package on the underlying package and sets up CMake targets with the
# same name as the original targets sans the version number in the target.
#
# However, since the vendor package is built with `GLOBAL_HOOK`, we can't
# install the `-config.cmake` file we're creating here to where the versioned
# `-config.cmake` from the underlying package is located. If we did, users can
# `find_package` the versionless package without first finding the vendor
# package. Thus, we install the `-config.cmake` file to a nonstandard
# location: `opt/${PROJECT_NAME}/extra_cmake/` and provide a
# `{vendor_name}-extras.cmake` file that adds that path to `CMAKE_PREFIX_PATH`.
ament_package(
CONFIG_EXTRAS_POST "gz_math_vendor-extras.cmake.in"
)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
configure_package_config_file(${LIB_NAME}-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LIB_NAME})
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}-config-version.cmake
VERSION ${LIB_VER}
COMPATIBILITY SameMajorVersion)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}-config-version.cmake
DESTINATION "opt/${PROJECT_NAME}/extra_cmake/lib/cmake/${LIB_NAME}")