Skip to content

Commit 9b50dfb

Browse files
committed
CMake: use CMAKE_INSTALL_FULL_INCLUDEDIR
Users may want to provide absolute paths in `CMAKE_INSTALL_INCLUDEDIR`. When this is the case, we should not prefix it in any way. To deal with this use case, use `CMAKE_INSTALL_FULL_*DIR` instead, ref. https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html#result-variables
1 parent 71d2d6a commit 9b50dfb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

install/PackageConfig.cmake.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ endif()
2525

2626
if(NOT TARGET zenohcxx)
2727
add_library(zenohcxx INTERFACE IMPORTED)
28-
target_include_directories(zenohcxx INTERFACE "${_IMPORT_PREFIX}/@CMAKE_INSTALL_INCLUDEDIR@")
28+
target_include_directories(zenohcxx INTERFACE "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
2929
endif()
3030

3131
# zenohcxx for zenohpico
3232
if(TARGET zenohpico::lib AND NOT TARGET zenohcxx_zenohpico)
3333
message(STATUS "defined lib target zenohcxx::zenohpico for zenohpico::lib")
3434
add_library(zenohcxx_zenohpico INTERFACE IMPORTED)
3535
target_compile_definitions(zenohcxx_zenohpico INTERFACE ZENOHCXX_ZENOHPICO)
36-
target_include_directories(zenohcxx_zenohpico INTERFACE "${_IMPORT_PREFIX}/@CMAKE_INSTALL_INCLUDEDIR@")
36+
target_include_directories(zenohcxx_zenohpico INTERFACE "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
3737
add_dependencies(zenohcxx_zenohpico zenohpico::lib)
3838
target_link_libraries(zenohcxx_zenohpico INTERFACE zenohpico::lib)
3939
add_library(zenohcxx::zenohpico ALIAS zenohcxx_zenohpico)
@@ -44,7 +44,7 @@ if(TARGET zenohc::lib AND NOT TARGET zenohcxx_zenohc)
4444
message(STATUS "defined lib target zenohcxx::zenohc for zenohc::lib")
4545
add_library(zenohcxx_zenohc INTERFACE IMPORTED)
4646
target_compile_definitions(zenohcxx_zenohc INTERFACE ZENOHCXX_ZENOHC)
47-
target_include_directories(zenohcxx_zenohc INTERFACE "${_IMPORT_PREFIX}/@CMAKE_INSTALL_INCLUDEDIR@")
47+
target_include_directories(zenohcxx_zenohc INTERFACE "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
4848
add_dependencies(zenohcxx_zenohc zenohc::lib)
4949
target_link_libraries(zenohcxx_zenohc INTERFACE zenohc::lib)
5050
add_library(zenohcxx::zenohc ALIAS zenohcxx_zenohc)

install/zenohcxx.pc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ Name: @PROJECT_NAME@
44
Description: @CMAKE_PROJECT_DESCRIPTION@
55
URL: @CMAKE_PROJECT_HOMEPAGE_URL@
66
Version: @PROJECT_VERSION@
7-
Cflags: -I${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
7+
Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@

0 commit comments

Comments
 (0)