summaryrefslogtreecommitdiffstats
path: root/build/cmake/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'build/cmake/CMakeLists.txt')
-rw-r--r--build/cmake/CMakeLists.txt23
1 files changed, 18 insertions, 5 deletions
diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
index 57501ee..913ea3a 100644
--- a/build/cmake/CMakeLists.txt
+++ b/build/cmake/CMakeLists.txt
@@ -114,18 +114,31 @@ if(BUILD_SHARED_LIBS)
list(APPEND LZ4_LIBRARIES_BUILT lz4_shared)
endif()
if(BUILD_STATIC_LIBS)
+ set(STATIC_LIB_NAME lz4)
+ if (MSVC AND BUILD_SHARED_LIBS)
+ set(STATIC_LIB_NAME lz4_static)
+ endif()
add_library(lz4_static STATIC ${LZ4_SOURCES})
set_target_properties(lz4_static PROPERTIES
- OUTPUT_NAME lz4
+ OUTPUT_NAME ${STATIC_LIB_NAME}
POSITION_INDEPENDENT_CODE ${LZ4_POSITION_INDEPENDENT_LIB})
list(APPEND LZ4_LIBRARIES_BUILT lz4_static)
endif()
-# link to shared whenever possible, to static otherwise
-if(BUILD_SHARED_LIBS)
- set(LZ4_LINK_LIBRARY lz4_shared)
+if(WIN32)
+# link to static library first because some functions may not exports to shared library
+ if(BUILD_STATIC_LIBS)
+ set(LZ4_LINK_LIBRARY lz4_static)
+ else()
+ set(LZ4_LINK_LIBRARY lz4_shared)
+ endif()
else()
- set(LZ4_LINK_LIBRARY lz4_static)
+# link to shared whenever possible, to static otherwise
+ if(BUILD_SHARED_LIBS)
+ set(LZ4_LINK_LIBRARY lz4_shared)
+ else()
+ set(LZ4_LINK_LIBRARY lz4_static)
+ endif()
endif()
# lz4