vcpkg/ports/lerc/cxx-linkage-pkgconfig.patch
Kai Pastor f56c8174eb
[tiff] Add lerc support (#35471)
* [lerc] Burn C++ linkage into pc file

* [tiff] Add lerc support

* [cmake-user] Test tiff with lerc

* [wxwidgets] Handle tiff/lerc C++ linkage trick
2024-02-08 22:41:50 -08:00

32 lines
1.0 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ec42013..8ac570a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,6 +52,16 @@ install(EXPORT LercTargets
)
# Configure and install pkgconfig file
+set(FAKE_CXX_LINKAGE "")
+foreach(lib IN LISTS CMAKE_CXX_IMPLICIT_LINK_LIBRARIES)
+ if(lib IN_LIST CMAKE_C_IMPLICIT_LINK_LIBRARIES)
+ continue()
+ elseif(EXISTS "${lib}")
+ string(APPEND FAKE_CXX_LINKAGE " ${CMAKE_LINK_LIBRARY_FILE_FLAG}${lib}")
+ else()
+ string(APPEND FAKE_CXX_LINKAGE " ${CMAKE_LINK_LIBRARY_FLAG}${lib}")
+ endif()
+endforeach()
configure_file(Lerc.pc.in ${CMAKE_CURRENT_BINARY_DIR}/Lerc.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Lerc.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
diff --git a/Lerc.pc.in b/Lerc.pc.in
index 96cf6eb..8856171 100644
--- a/Lerc.pc.in
+++ b/Lerc.pc.in
@@ -9,4 +9,4 @@ URL: @PROJECT_HOMEPAGE_URL@
Version: @PROJECT_VERSION@
Cflags: -I${includedir}
Cflags.private: -DLERC_STATIC
-Libs: -L${libdir} -lLerc
+Libs: -L${libdir} -lLerc @FAKE_CXX_LINKAGE@