diff options
author | Yann Collet <Cyan4973@users.noreply.github.com> | 2018-08-09 21:07:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-09 21:07:45 (GMT) |
commit | c4dbc37b3ce085a05441124fee4a8144dc149b05 (patch) | |
tree | 234dd59a6d96dd4d750272b51460d28a77becdfb /contrib | |
parent | 60b1c5e3f202aba7062775cd18f5a522a0f12d80 (diff) | |
parent | 672ff590b2e0d1cc9cb237d05af8490e68f9e94d (diff) | |
download | lz4-c4dbc37b3ce085a05441124fee4a8144dc149b05.zip lz4-c4dbc37b3ce085a05441124fee4a8144dc149b05.tar.gz lz4-c4dbc37b3ce085a05441124fee4a8144dc149b05.tar.bz2 |
Merge pull request #553 from mrjoel/mrjoel/cmake-optional-lz4c
Add CMake option to not build legacy lz4c program
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/cmake_unofficial/CMakeLists.txt | 14 |
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}" |