Skip to content

Replace join_paths with cmake_path(APPEND) #498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: gz-cmake4
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,10 @@ file(RELATIVE_PATH
"${CMAKE_INSTALL_PREFIX}"
)

# TODO(jrivero): CMake 3.20 provides cmake_path(APPEND) which implements the
# same functionality as join_paths(). Remove JoinPaths in the next major version
# if all the supported platforms are in 3.20 version.
include(JoinPaths)
join_paths(GZ_PC_LIBDIR "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
join_paths(GZ_PC_INCLUDEDIR "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}" "${GZ_INCLUDE_INSTALL_DIR_POSTFIX}")
cmake_path(APPEND "\${prefix}" "${CMAKE_INSTALL_LIBDIR}"
OUTPUT_VARIABLE GZ_PC_LIBDIR)
cmake_path(APPEND "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}" "${GZ_INCLUDE_INSTALL_DIR_POSTFIX}"
OUTPUT_VARIABLE GZ_PC_INCLUDEDIR)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't actually work the same

before this change gz-cmake4.pc has the following line:

includedir=${prefix}/include/gz/cmake4

and after this change it is

includedir=include/gz/cmake4

I think the first argument to cmake_path(APPEND needs to be a cmake variable, not an expression that is meant to be evaluated at pkg-config runtime. I'm not sure how to use cmake_path(APPEND in this case


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

Expand Down