summaryrefslogtreecommitdiffstats
path: root/build/cmake
diff options
context:
space:
mode:
authorlifegpc <g1710431395@gmail.com>2021-07-01 11:48:30 (GMT)
committerlifegpc <g1710431395@gmail.com>2021-07-01 11:48:30 (GMT)
commit756ca1a7f2515786a4bc7fbede22c37580f7ffe3 (patch)
tree86447f0cd70ab9b17b224ca2ede2694c19cec88f /build/cmake
parent5ed199da042a0b39036ffad53894adadbc214172 (diff)
downloadlz4-756ca1a7f2515786a4bc7fbede22c37580f7ffe3.zip
lz4-756ca1a7f2515786a4bc7fbede22c37580f7ffe3.tar.gz
lz4-756ca1a7f2515786a4bc7fbede22c37580f7ffe3.tar.bz2
Link static library first otherwise rebuild source files.
Diffstat (limited to 'build/cmake')
-rw-r--r--build/cmake/CMakeLists.txt20
1 files changed, 6 insertions, 14 deletions
diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
index 913ea3a..a7e563d 100644
--- a/build/cmake/CMakeLists.txt
+++ b/build/cmake/CMakeLists.txt
@@ -125,20 +125,10 @@ if(BUILD_STATIC_LIBS)
list(APPEND LZ4_LIBRARIES_BUILT lz4_static)
endif()
-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()
+if(BUILD_STATIC_LIBS)
+ set(LZ4_LINK_LIBRARY lz4_static)
else()
-# 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()
+ list(APPEND LZ4_CLI_SOURCES ${LZ4_SOURCES})
endif()
# lz4
@@ -146,7 +136,9 @@ if (LZ4_BUILD_CLI)
set(LZ4_PROGRAMS_BUILT lz4cli)
add_executable(lz4cli ${LZ4_CLI_SOURCES})
set_target_properties(lz4cli PROPERTIES OUTPUT_NAME lz4)
- target_link_libraries(lz4cli ${LZ4_LINK_LIBRARY})
+ if (BUILD_STATIC_LIBS)
+ target_link_libraries(lz4cli ${LZ4_LINK_LIBRARY})
+ endif()
endif()
# lz4c