diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 4cb11472f..c6366eef5 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -448,10 +448,14 @@ if (PKG_CONFIG_FOUND) # BUG: The following code will NOT work well with `cmake --install ... --prefix ` # due to this code relying on CMAKE_INSTALL_PREFIX being defined at configure time. + # + # NOTE: vulkan.pc essentially cover both Vulkan-Loader and Vulkan-Headers for legacy reasons. if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "") set(CMAKE_INSTALL_LIBDIR_PC ${CMAKE_INSTALL_FULL_LIBDIR}) + set(CMAKE_INSTALL_INCLUDEDIR_PC ${CMAKE_INSTALL_FULL_INCLUDEDIR}) else() file(RELATIVE_PATH CMAKE_INSTALL_LIBDIR_PC ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_FULL_LIBDIR}) + file(RELATIVE_PATH CMAKE_INSTALL_INCLUDEDIR_PC ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_FULL_INCLUDEDIR}) endif() configure_file("vulkan.pc.in" "vulkan.pc" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/vulkan.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") diff --git a/loader/vulkan.pc.in b/loader/vulkan.pc.in index 16b0ded79..6a285f267 100644 --- a/loader/vulkan.pc.in +++ b/loader/vulkan.pc.in @@ -1,4 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR_PC@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR_PC@ + Name: Vulkan-Loader Description: Vulkan Loader Version: @VULKAN_LOADER_VERSION@ -Libs: -L@CMAKE_INSTALL_LIBDIR_PC@ -lvulkan@VULKAN_LIB_SUFFIX@ +Libs: -L${libdir} -lvulkan@VULKAN_LIB_SUFFIX@ +Cflags: -I${includedir}