summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorJoel Johnson <mrjoel@lixil.net>2018-08-02 06:23:00 (GMT)
committerJoel Johnson <mrjoel@lixil.net>2018-08-09 18:40:55 (GMT)
commit672ff590b2e0d1cc9cb237d05af8490e68f9e94d (patch)
tree234dd59a6d96dd4d750272b51460d28a77becdfb /contrib
parent60b1c5e3f202aba7062775cd18f5a522a0f12d80 (diff)
downloadlz4-672ff590b2e0d1cc9cb237d05af8490e68f9e94d.zip
lz4-672ff590b2e0d1cc9cb237d05af8490e68f9e94d.tar.gz
lz4-672ff590b2e0d1cc9cb237d05af8490e68f9e94d.tar.bz2
Add CMake option to not build legacy lz4c program
Diffstat (limited to 'contrib')
-rw-r--r--contrib/cmake_unofficial/CMakeLists.txt14
1 files changed, 10 insertions, 4 deletions
diff --git a/contrib/cmake_unofficial/CMakeLists.txt b/contrib/cmake_unofficial/CMakeLists.txt
index 27c3a78..b09c4fb 100644
--- a/contrib/cmake_unofficial/CMakeLists.txt
+++ b/contrib/cmake_unofficial/CMakeLists.txt
@@ -12,6 +12,8 @@
set(LZ4_TOP_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..")
+option(LZ4_BUILD_LEGACY_LZ4C "Build lz4c progam with legacy argument support" ON)
+
# Parse version information
file(STRINGS "${LZ4_TOP_SOURCE_DIR}/lib/lz4.h" LZ4_VERSION_MAJOR REGEX "^#define LZ4_VERSION_MAJOR +([0-9]+) +.*$")
string(REGEX REPLACE "^#define LZ4_VERSION_MAJOR +([0-9]+) +.*$" "\\1" LZ4_VERSION_MAJOR "${LZ4_VERSION_MAJOR}")
@@ -122,14 +124,18 @@ else()
endif()
# lz4
+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})
# lz4c
-add_executable(lz4c ${LZ4_CLI_SOURCES})
-set_target_properties(lz4c PROPERTIES COMPILE_DEFINITIONS "ENABLE_LZ4C_LEGACY_OPTIONS")
-target_link_libraries(lz4c ${LZ4_LINK_LIBRARY})
+if (LZ4_BUILD_LEGACY_LZ4C)
+ list(APPEND LZ4_PROGRAMS_BUILT lz4c)
+ add_executable(lz4c ${LZ4_CLI_SOURCES})
+ set_target_properties(lz4c PROPERTIES COMPILE_DEFINITIONS "ENABLE_LZ4C_LEGACY_OPTIONS")
+ target_link_libraries(lz4c ${LZ4_LINK_LIBRARY})
+endif()
# Extra warning flags
include (CheckCCompilerFlag)
@@ -165,7 +171,7 @@ endforeach (flag)
if(NOT LZ4_BUNDLED_MODE)
include(GNUInstallDirs)
- install(TARGETS lz4cli lz4c
+ install(TARGETS ${LZ4_PROGRAMS_BUILT}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(TARGETS ${LZ4_LIBRARIES_BUILT}
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"