vcpkg/ports/zstd/fix-buildsystem.diff
2017-05-05 12:10:49 +02:00

101 lines
3.9 KiB
Diff

diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
index 5c4eca6..2f933e2 100644
--- a/build/cmake/CMakeLists.txt
+++ b/build/cmake/CMakeLists.txt
@@ -15,8 +15,8 @@ LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
#-----------------------------------------------------------------------------
# Add extra compilation flags
#-----------------------------------------------------------------------------
-INCLUDE(AddZstdCompilationFlags)
-ADD_ZSTD_COMPILATION_FLAGS()
+#INCLUDE(AddZstdCompilationFlags)
+#ADD_ZSTD_COMPILATION_FLAGS() Combination of flags set there makes no sense & triggers compiler errors in release
#-----------------------------------------------------------------------------
# Options
diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt
index 429d494..4c13057 100644
--- a/build/cmake/lib/CMakeLists.txt
+++ b/build/cmake/lib/CMakeLists.txt
@@ -90,37 +90,34 @@ IF (MSVC)
ENDIF (MSVC)
# Split project to static and shared libraries build
-ADD_LIBRARY(libzstd_shared SHARED ${Sources} ${Headers} ${PlatformDependResources})
+IF (ZSTD_BUILD_SHARED)
+ ADD_LIBRARY(libzstd_shared SHARED ${Sources} ${Headers} ${PlatformDependResources})
+ENDIF(ZSTD_BUILD_SHARED)
IF (ZSTD_BUILD_STATIC)
ADD_LIBRARY(libzstd_static STATIC ${Sources} ${Headers})
ENDIF (ZSTD_BUILD_STATIC)
# Add specific compile definitions for MSVC project
IF (MSVC)
- SET_PROPERTY(TARGET libzstd_shared APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_DLL_EXPORT=1;ZSTD_HEAPMODE=0;_CONSOLE;_CRT_SECURE_NO_WARNINGS")
+ 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")
+ ENDIF(ZSTD_BUILD_SHARED)
IF (ZSTD_BUILD_STATIC)
SET_PROPERTY(TARGET libzstd_static APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_HEAPMODE=0;_CRT_SECURE_NO_WARNINGS")
ENDIF (ZSTD_BUILD_STATIC)
ENDIF (MSVC)
# Define library base name
-IF (MSVC)
-
- IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
- SET(LIBRARY_BASE_NAME "zstdlib_x64")
- ELSE ()
- SET(LIBRARY_BASE_NAME "zstdlib_x86")
- ENDIF (CMAKE_SIZEOF_VOID_P MATCHES "8")
-ELSE ()
- SET(LIBRARY_BASE_NAME zstd)
-ENDIF (MSVC)
+SET(LIBRARY_BASE_NAME zstd)
# Define static and shared library names
-SET_TARGET_PROPERTIES(
- libzstd_shared
- PROPERTIES
- OUTPUT_NAME ${LIBRARY_BASE_NAME}
- SOVERSION ${LIBVER_MAJOR}.${LIBVER_MINOR}.${LIBVER_RELEASE})
+IF(ZSTD_BUILD_SHARED)
+ SET_TARGET_PROPERTIES(
+ libzstd_shared
+ PROPERTIES
+ OUTPUT_NAME ${LIBRARY_BASE_NAME}
+ SOVERSION ${LIBVER_MAJOR}.${LIBVER_MINOR}.${LIBVER_RELEASE})
+ENDIF(ZSTD_BUILD_SHARED)
IF (ZSTD_BUILD_STATIC)
SET_TARGET_PROPERTIES(
@@ -129,6 +126,15 @@ IF (ZSTD_BUILD_STATIC)
OUTPUT_NAME ${LIBRARY_BASE_NAME})
ENDIF (ZSTD_BUILD_STATIC)
+
+INSTALL(FILES ${LIBRARY_DIR}/zstd.h ${LIBRARY_DIR}/deprecated/zbuff.h ${LIBRARY_DIR}/dictBuilder/zdict.h DESTINATION "include")
+IF(ZSTD_BUILD_SHARED)
+ INSTALL(TARGETS libzstd_shared RUNTIME DESTINATION "bin" ARCHIVE DESTINATION "lib" LIBRARY DESTINATION "lib")
+ENDIF(ZSTD_BUILD_SHARED)
+IF (ZSTD_BUILD_STATIC)
+ INSTALL(TARGETS libzstd_static ARCHIVE DESTINATION "lib")
+ENDIF (ZSTD_BUILD_STATIC)
+
IF (UNIX)
# pkg-config
SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
@@ -142,12 +148,7 @@ IF (UNIX)
COMMENT "Creating pkg-config file")
# install target
- INSTALL(FILES ${LIBRARY_DIR}/zstd.h ${LIBRARY_DIR}/deprecated/zbuff.h ${LIBRARY_DIR}/dictBuilder/zdict.h DESTINATION "include")
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/libzstd.pc" DESTINATION "share/pkgconfig")
- INSTALL(TARGETS libzstd_shared LIBRARY DESTINATION "lib")
- IF (ZSTD_BUILD_STATIC)
- INSTALL(TARGETS libzstd_static ARCHIVE DESTINATION "lib")
- ENDIF (ZSTD_BUILD_STATIC)
# uninstall target
CONFIGURE_FILE(