mirror of https://git.tukaani.org/xz.git
CMake: Use relative paths in liblzma.pc if possible
Now liblzma.pc can be relocatable only if using CMake >= 3.20 but that should be OK as now we shouldn't get broken liblzma.pc if CMAKE_INSTALL_LIBDIR or CMAKE_INSTALL_INCLUDEDIR contain an absolute path. Thanks to Eli Schwartz.
This commit is contained in:
parent
7a366d93cf
commit
ebd155c3a1
|
@ -1413,11 +1413,21 @@ endif()
|
||||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/liblzma-config.cmake"
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/liblzma-config.cmake"
|
||||||
"${LZMA_CONFIG_CONTENTS}")
|
"${LZMA_CONFIG_CONTENTS}")
|
||||||
|
|
||||||
# Create liblzma.pc.
|
# Create liblzma.pc. If using CMake >= 3.20 and CMAKE_INSTALL_<dir> paths
|
||||||
|
# are relative to CMAKE_INSTALL_PREFIX, the .pc file will be relocatable
|
||||||
|
# (that is, all paths will be relative to ${prefix}). Otherwise absolute
|
||||||
|
# paths will be used.
|
||||||
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
||||||
set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
|
set(exec_prefix "\${prefix}")
|
||||||
set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")
|
|
||||||
set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.20")
|
||||||
|
cmake_path(APPEND libdir "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
cmake_path(APPEND includedir "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
else()
|
||||||
|
set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")
|
||||||
|
set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(PTHREAD_CFLAGS "${CMAKE_THREAD_LIBS_INIT}")
|
set(PTHREAD_CFLAGS "${CMAKE_THREAD_LIBS_INIT}")
|
||||||
configure_file(src/liblzma/liblzma.pc.in liblzma.pc
|
configure_file(src/liblzma/liblzma.pc.in liblzma.pc
|
||||||
@ONLY
|
@ONLY
|
||||||
|
|
Loading…
Reference in New Issue