diff options
author | Attila Oláh <atl@google.com> | 2020-09-23 12:49:25 (GMT) |
---|---|---|
committer | Attila Oláh <atl@google.com> | 2020-09-23 12:56:01 (GMT) |
commit | 63942cdebadc26e7ed43c37dc0d35db2fb71304b (patch) | |
tree | 94ca01969c5a2779899c7df6ae25b635e35e36c2 | |
parent | dc27b7ae4157024384b4766e501d9ba2788ddfd3 (diff) | |
download | lz4-63942cdebadc26e7ed43c37dc0d35db2fb71304b.zip lz4-63942cdebadc26e7ed43c37dc0d35db2fb71304b.tar.gz lz4-63942cdebadc26e7ed43c37dc0d35db2fb71304b.tar.bz2 |
Add CMake option LZ4_BUILD_CLI.
Defaults to ON so nothing changes, but it can be set to OFF so that the
CLI is not built at all, only the library.
-rw-r--r-- | build/cmake/CMakeLists.txt | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt index 42d92ea..1bb2f5a 100644 --- a/build/cmake/CMakeLists.txt +++ b/build/cmake/CMakeLists.txt @@ -12,6 +12,7 @@ set(LZ4_TOP_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..") +option(LZ4_BUILD_CLI "Build lz4 program" ON) option(LZ4_BUILD_LEGACY_LZ4C "Build lz4c progam with legacy argument support" ON) # Parse version information @@ -124,10 +125,12 @@ 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}) +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}) +endif() # lz4c if (LZ4_BUILD_LEGACY_LZ4C) @@ -189,7 +192,7 @@ if(NOT LZ4_BUNDLED_MODE) DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") # install lz4cat and unlz4 symlinks on *nix - if(UNIX) + if(UNIX AND LZ4_BUILD_CLI) install(CODE " foreach(f lz4cat unlz4) set(dest \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/\${f}\") @@ -205,7 +208,7 @@ if(NOT LZ4_BUNDLED_MODE) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${f}.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") endforeach() - endif(UNIX) + endif(UNIX AND LZ4_BUILD_CLI) endif(NOT LZ4_BUNDLED_MODE) # pkg-config |