Skip to content
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

Ensure relocatable config files #419

Merged
merged 7 commits into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from 6 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
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,16 @@ else (build_errors)

########################################
# Make the package config file
set(PC_CONFIG_INSTALL_DIR ${LIB_INSTALL_DIR}/pkgconfig)
file(RELATIVE_PATH
PC_CONFIG_RELATIVE_PATH_TO_PREFIX
"${CMAKE_INSTALL_PREFIX}/${PC_CONFIG_INSTALL_DIR}"
"${CMAKE_INSTALL_PREFIX}"
)
configure_file(${CMAKE_SOURCE_DIR}/cmake/sdformat_pc.in
${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME_LOWER}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME_LOWER}.pc DESTINATION
${LIB_INSTALL_DIR}/pkgconfig COMPONENT pkgconfig)
${PC_CONFIG_INSTALL_DIR} COMPONENT pkgconfig)

########################################
# Configure documentation uploader
Expand Down
8 changes: 4 additions & 4 deletions cmake/sdf_config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ if(NOT TARGET @sdf_import_target_name@)
include("${CMAKE_CURRENT_LIST_DIR}/@sdf_target_output_filename@")
endif()

list(APPEND @PKG_NAME@_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include/sdformat-@SDF_VERSION@")
list(APPEND @PKG_NAME@_INCLUDE_DIRS "${PACKAGE_PREFIX_DIR}/include/sdformat-@SDF_VERSION@")

list(APPEND @PKG_NAME@_CFLAGS "-I@CMAKE_INSTALL_PREFIX@/include/sdformat-@SDF_VERSION@")
list(APPEND @PKG_NAME@_CFLAGS "-I${PACKAGE_PREFIX_DIR}/include/sdformat-@SDF_VERSION@")
if (NOT WIN32)
list(APPEND @PKG_NAME@_CXX_FLAGS "${@PKG_NAME@_CFLAGS} -std=c++17")
endif()

list(APPEND @PKG_NAME@_LIBRARY_DIRS "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@")
list(APPEND @PKG_NAME@_LIBRARY_DIRS "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@")

set(@PKG_NAME@_LIBRARIES @sdf_import_target_name@)

Expand All @@ -37,4 +37,4 @@ find_package(ignition-math@IGN_MATH_VER@)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${IGNITION-MATH_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARY_DIRS ${IGNITION-MATH_LIBRARY_DIRS})

list(APPEND @PKG_NAME@_LDFLAGS "-L@CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@")
list(APPEND @PKG_NAME@_LDFLAGS "-L${PACKAGE_PREFIX_DIR}/@LIB_INSTALL_DIR@")
2 changes: 1 addition & 1 deletion cmake/sdformat_pc.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
prefix="@CMAKE_INSTALL_PREFIX@"
prefix=${pcfiledir}/@PC_CONFIG_RELATIVE_PATH_TO_PREFIX@
libdir=${prefix}/@LIB_INSTALL_DIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@

Expand Down