Skip to content

Commit

Permalink
keep the path for pkg-config path if they are absolute
Browse files Browse the repository at this point in the history
Fixes #97
  • Loading branch information
robUx4 committed May 15, 2022
1 parent df7a12e commit 83d30f0
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,34 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ebml_export.h DESTINATION ${CMAKE_INST
if(NOT DISABLE_PKGCONFIG)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\$\{prefix\}")
set(libdir "\$\{prefix\}/${CMAKE_INSTALL_LIBDIR}")
set(includedir "\$\{prefix\}/${CMAKE_INSTALL_INCLUDEDIR}")
if(${CMAKE_VERSION} VERSION_LESS "3.20.0")
get_filename_component(absdir ${CMAKE_INSTALL_LIBDIR} ABSOLUTE)
if (absdir STREQUAL CMAKE_INSTALL_LIBDIR)
set(abs_libdir ON)
else()
set(abs_libdir OFF)
endif()
get_filename_component(absdir ${CMAKE_INSTALL_INCLUDEDIR} ABSOLUTE)
if (absdir STREQUAL CMAKE_INSTALL_INCLUDEDIR)
set(abs_incdir ON)
else()
set(abs_incdir OFF)
endif()
else()
cmake_path(IS_ABSOLUTE CMAKE_INSTALL_LIBDIR abs_libdir)
cmake_path(IS_ABSOLUTE CMAKE_INSTALL_INCLUDEDIR abs_incdir)
endif()
if (${abs_libdir})
set(libdir "${CMAKE_INSTALL_LIBDIR}")
else()
message(STATUS "using relative \$\{prefix\}/${CMAKE_INSTALL_LIBDIR}")
set(libdir "\$\{prefix\}/${CMAKE_INSTALL_LIBDIR}")
endif()
if (${abs_incdir})
set(includedir "${CMAKE_INSTALL_INCLUDEDIR}")
else()
set(includedir "\$\{prefix\}/${CMAKE_INSTALL_INCLUDEDIR}")
endif()
set(PACKAGE_VERSION ${PROJECT_VERSION})
if (HAVE_WINAPIFAMILY_H)
set(WINAPIFAMILY_PC -DHAVE_WINAPIFAMILY_H)
Expand Down

0 comments on commit 83d30f0

Please sign in to comment.