File tree Expand file tree Collapse file tree 4 files changed +30
-2
lines changed Expand file tree Collapse file tree 4 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ else()
3535endif ()
3636string (REGEX REPLACE "[^/]+" ".." RELATIVE_PATH_CMAKE_DIR_TO_PREFIX "${CMAKE_CONFIG_INSTALL_DIR} " )
3737
38+ include (cmake/JoinPaths.cmake)
39+ join_paths(cmake_conf_include_dirs
40+ "\$ {${PROJECT_NAME} _DIR}/${RELATIVE_PATH_CMAKE_DIR_TO_PREFIX} "
41+ "${CMAKE_INSTALL_INCLUDEDIR} " )
42+
3843set (PACKAGE_NAME ${PROJECT_NAME} )
3944set (cmake_conf_file "${PROJECT_NAME} -config.cmake" )
4045configure_file ("${CMAKE_CURRENT_SOURCE_DIR} /cmake/${cmake_conf_file} .in" "${CMAKE_BINARY_DIR} /${cmake_conf_file} " @ONLY)
@@ -56,6 +61,7 @@ install(FILES
5661# Make the package config file
5762set (PACKAGE_DESC "Unified Robot Description Format" )
5863set (pkg_conf_file "urdfdom_headers.pc" )
64+ join_paths(pkg_conf_includedir "\$ {prefix}" "${CMAKE_INSTALL_INCLUDEDIR} " )
5965configure_file ("${CMAKE_CURRENT_SOURCE_DIR} /cmake/pkgconfig/${pkg_conf_file} .in" "${CMAKE_BINARY_DIR} /${pkg_conf_file} " @ONLY)
6066install (FILES "${CMAKE_BINARY_DIR} /${pkg_conf_file} " DESTINATION ${CMAKE_INSTALL_LIBDIR} /pkgconfig/ COMPONENT pkgconfig)
6167
Original file line number Diff line number Diff line change 1+ # This module provides a function for joining paths
2+ # known from most languages
3+ #
4+ # SPDX-License-Identifier: (MIT OR CC0-1.0)
5+ # Copyright 2020 Jan Tojnar
6+ # https://github.com/jtojnar/cmake-snips
7+ #
8+ # Modelled after Python’s os.path.join
9+ # https://docs.python.org/3.7/library/os.path.html#os.path.join
10+ function (join_paths joined_path first_path_segment)
11+ set (temp_path "${first_path_segment} " )
12+ foreach (current_segment IN LISTS ARGN)
13+ if (NOT ("${current_segment} " STREQUAL "" ))
14+ if (IS_ABSOLUTE "${current_segment} " )
15+ set (temp_path "${current_segment} " )
16+ else ()
17+ set (temp_path "${temp_path} /${current_segment} " )
18+ endif ()
19+ endif ()
20+ endforeach ()
21+ set (${joined_path} "${temp_path} " PARENT_SCOPE)
22+ endfunction ()
Original file line number Diff line number Diff line change 11# This file was generated by CMake for @PROJECT_NAME@
22prefix=@CMAKE_INSTALL_PREFIX@
33exec_prefix=${prefix}
4- includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR @
4+ includedir=@pkg_conf_includedir @
55
66Name: @PACKAGE_NAME@
77Description: @PACKAGE_DESC@
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ if (@PACKAGE_NAME@_CONFIG_INCLUDED)
33endif ()
44set (@PACKAGE_NAME@_CONFIG_INCLUDED TRUE )
55
6- set (@PACKAGE_NAME@_INCLUDE_DIRS "${@PROJECT_NAME@_DIR}/@RELATIVE_PATH_CMAKE_DIR_TO_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR @" )
6+ set (@PACKAGE_NAME@_INCLUDE_DIRS "@cmake_conf_include_dirs @" )
77
88include (
"${@PACKAGE_NAME@_DIR}/@[email protected] " )
99
You can’t perform that action at this time.
0 commit comments