vcpkg/ports/libjxl/trim-shared-build.patch
Kai Pastor 14b8851a67
[libjxl] Cleanup (#29190)
* [libjxl] Trim patch

* Trim static targets during shared build

* Cleanup
2023-01-26 19:45:43 -08:00

38 lines
1.3 KiB
Diff

diff --git a/lib/jxl.cmake b/lib/jxl.cmake
index a8a96e1..a42b6f0 100644
--- a/lib/jxl.cmake
+++ b/lib/jxl.cmake
@@ -556,8 +556,13 @@ if (NOT WIN32 OR MINGW)
set_target_properties(jxl-static PROPERTIES OUTPUT_NAME "jxl")
set_target_properties(jxl_dec-static PROPERTIES OUTPUT_NAME "jxl_dec")
endif()
+if(BUILD_SHARED_LIBS)
+ set_target_properties(jxl-static PROPERTIES EXCLUDE_FROM_ALL 1)
+ set_target_properties(jxl_dec-static PROPERTIES EXCLUDE_FROM_ALL 1)
+else()
install(TARGETS jxl-static DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS jxl_dec-static DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
if (BUILD_SHARED_LIBS)
diff --git a/lib/jxl_threads.cmake b/lib/jxl_threads.cmake
index 006e71e..b8ce66b 100644
--- a/lib/jxl_threads.cmake
+++ b/lib/jxl_threads.cmake
@@ -43,10 +43,14 @@ set_target_properties(${_target} PROPERTIES
if (NOT WIN32 OR MINGW)
set_target_properties(${_target} PROPERTIES OUTPUT_NAME "jxl_threads")
endif()
+if(BUILD_SHARED_LIBS AND _target MATCHES "-static")
+ set_target_properties(${_target} PROPERTIES EXCLUDE_FROM_ALL 1)
+else()
install(TARGETS ${_target}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
endfunction()