Skip to content

Commit e1cbc89

Browse files
committed
Replace join_paths with cmake_path(APPEND)
Signed-off-by: Steve Peters <[email protected]>
1 parent 7be1242 commit e1cbc89

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

CMakeLists.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,13 @@ file(RELATIVE_PATH
101101
"${CMAKE_INSTALL_PREFIX}"
102102
)
103103

104-
# TODO(jrivero): CMake 3.20 provides cmake_path(APPEND) which implements the
105-
# same functionality as join_paths(). Remove JoinPaths in the next major version
106-
# if all the supported platforms are in 3.20 version.
107-
include(JoinPaths)
108-
join_paths(GZ_PC_LIBDIR "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
109-
join_paths(GZ_PC_INCLUDEDIR "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}" "${GZ_INCLUDE_INSTALL_DIR_POSTFIX}")
104+
# Use cmake_path(APPEND) to construct path variables used in pkg-config file.
105+
# Since the first argument to this function must be a cmake variable (not a
106+
# string constant, initialize the variable to the first path component.
107+
set(GZ_PC_LIBDIR "\${prefix}")
108+
cmake_path(APPEND GZ_PC_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
109+
set(GZ_PC_INCLUDEDIR "\${prefix}")
110+
cmake_path(APPEND GZ_PC_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}" "${GZ_INCLUDE_INSTALL_DIR_POSTFIX}")
110111

111112
configure_file(${gz_pkgconfig_input} ${gz_pkgconfig_output} @ONLY)
112113

0 commit comments

Comments
 (0)