vcpkg/ports/zstd/0001-export-zstd-config.patch

94 lines
3.9 KiB
Diff
Raw Normal View History

2020-04-14 03:39:29 +08:00
diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt
index 7adca875..8835d1c6 100644
--- a/build/cmake/lib/CMakeLists.txt
+++ b/build/cmake/lib/CMakeLists.txt
@@ -78,20 +78,20 @@ endif ()
# Split project to static and shared libraries build
if (ZSTD_BUILD_SHARED)
- add_library(libzstd_shared SHARED ${Sources} ${Headers} ${PlatformDependResources})
+ add_library(libzstd SHARED ${Sources} ${Headers} ${PlatformDependResources})
if (ZSTD_MULTITHREAD_SUPPORT)
- set_property(TARGET libzstd_shared APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD")
+ set_property(TARGET libzstd APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD")
if (UNIX)
- target_link_libraries(libzstd_shared ${THREADS_LIBS})
+ target_link_libraries(libzstd ${THREADS_LIBS})
endif ()
endif()
endif ()
if (ZSTD_BUILD_STATIC)
- add_library(libzstd_static STATIC ${Sources} ${Headers})
+ add_library(libzstd STATIC ${Sources} ${Headers})
if (ZSTD_MULTITHREAD_SUPPORT)
- set_property(TARGET libzstd_static APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD")
+ set_property(TARGET libzstd APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD")
if (UNIX)
- target_link_libraries(libzstd_static ${THREADS_LIBS})
+ target_link_libraries(libzstd ${THREADS_LIBS})
endif ()
endif ()
endif ()
@@ -99,16 +99,16 @@ endif ()
# Add specific compile definitions for MSVC project
if (MSVC)
if (ZSTD_BUILD_SHARED)
- set_property(TARGET libzstd_shared APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_DLL_EXPORT=1;ZSTD_HEAPMODE=0;_CONSOLE;_CRT_SECURE_NO_WARNINGS")
+ set_property(TARGET libzstd APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_DLL_EXPORT=1;ZSTD_HEAPMODE=0;_CONSOLE;_CRT_SECURE_NO_WARNINGS")
endif ()
if (ZSTD_BUILD_STATIC)
- set_property(TARGET libzstd_static APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_HEAPMODE=0;_CRT_SECURE_NO_WARNINGS")
+ set_property(TARGET libzstd APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_HEAPMODE=0;_CRT_SECURE_NO_WARNINGS")
endif ()
endif ()
# With MSVC static library needs to be renamed to avoid conflict with import library
if (MSVC)
- set(STATIC_LIBRARY_BASE_NAME zstd_static)
+ set(STATIC_LIBRARY_BASE_NAME zstd)
else ()
set(STATIC_LIBRARY_BASE_NAME zstd)
endif ()
@@ -116,7 +116,7 @@ endif ()
# Define static and shared library names
if (ZSTD_BUILD_SHARED)
set_target_properties(
- libzstd_shared
+ libzstd
PROPERTIES
OUTPUT_NAME zstd
VERSION ${zstd_VERSION_MAJOR}.${zstd_VERSION_MINOR}.${zstd_VERSION_PATCH}
@@ -125,7 +125,7 @@ endif ()
if (ZSTD_BUILD_STATIC)
set_target_properties(
- libzstd_static
+ libzstd
PROPERTIES
OUTPUT_NAME ${STATIC_LIBRARY_BASE_NAME})
endif ()
@@ -154,12 +154,14 @@ install(FILES
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
if (ZSTD_BUILD_SHARED)
- install(TARGETS libzstd_shared RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ install(TARGETS libzstd EXPORT zstd-config
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif()
if (ZSTD_BUILD_STATIC)
- install(TARGETS libzstd_static ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+ install(TARGETS libzstd EXPORT zstd-config
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif ()
# uninstall target
@@ -172,3 +174,6 @@ if (NOT TARGET uninstall)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif ()
+
+target_include_directories(libzstd PUBLIC $<INSTALL_INTERFACE:include>)
+install(EXPORT zstd-config DESTINATION share/cmake/zstd)