diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt index 02a81b3c..c9dab0d5 100644 --- a/build/cmake/CMakeLists.txt +++ b/build/cmake/CMakeLists.txt @@ -45,19 +45,19 @@ option(ZSTD_LEGACY_SUPPORT "LEGACY SUPPORT" OFF) if (ZSTD_LEGACY_SUPPORT) message(STATUS "ZSTD_LEGACY_SUPPORT defined!") add_definitions(-DZSTD_LEGACY_SUPPORT=4) -else (ZSTD_LEGACY_SUPPORT) +else () message(STATUS "ZSTD_LEGACY_SUPPORT not defined!") add_definitions(-DZSTD_LEGACY_SUPPORT=0) -endif (ZSTD_LEGACY_SUPPORT) +endif () # Multi-threading support option(ZSTD_MULTITHREAD_SUPPORT "MULTITHREADING SUPPORT" ON) if (ZSTD_MULTITHREAD_SUPPORT) message(STATUS "ZSTD_MULTITHREAD_SUPPORT is enabled") -else (ZSTD_MULTITHREAD_SUPPORT) +else () message(STATUS "ZSTD_MULTITHREAD_SUPPORT is disabled") -endif (ZSTD_MULTITHREAD_SUPPORT) +endif () option(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" ON) option(ZSTD_BUILD_CONTRIB "BUILD CONTRIB" OFF) @@ -77,7 +77,7 @@ if (ZSTD_MULTITHREAD_SUPPORT AND UNIX) else() message(SEND_ERROR "ZSTD currently does not support thread libraries other than pthreads") endif() -endif (ZSTD_MULTITHREAD_SUPPORT AND UNIX) +endif () #----------------------------------------------------------------------------- # Add source directories @@ -87,22 +87,22 @@ add_subdirectory(lib) if (ZSTD_BUILD_PROGRAMS) if (NOT ZSTD_BUILD_STATIC) message(SEND_ERROR "You need to build static library to build zstd CLI") - endif (NOT ZSTD_BUILD_STATIC) + endif () add_subdirectory(programs) -endif (ZSTD_BUILD_PROGRAMS) +endif () if (ZSTD_BUILD_TESTS) if (NOT ZSTD_BUILD_STATIC) message(SEND_ERROR "You need to build static library to build tests") - endif (NOT ZSTD_BUILD_STATIC) + endif () add_subdirectory(tests) -endif (ZSTD_BUILD_TESTS) +endif () if (ZSTD_BUILD_CONTRIB) add_subdirectory(contrib) -endif (ZSTD_BUILD_CONTRIB) +endif () #----------------------------------------------------------------------------- # Add clean-all target diff --git a/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake b/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake index 8d464c06..5e65cedb 100644 --- a/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake +++ b/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake @@ -53,7 +53,7 @@ macro(ADD_ZSTD_COMPILATION_FLAGS) separate_arguments(${flag_var}) list(REMOVE_DUPLICATES ${flag_var}) string(REPLACE ";" " " ${flag_var} "${${flag_var}}") - endforeach (flag_var) + endforeach () if (MSVC AND ZSTD_USE_STATIC_RUNTIME) foreach (flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE @@ -61,7 +61,7 @@ macro(ADD_ZSTD_COMPILATION_FLAGS) CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - endforeach (flag_var) + endforeach () endif () -endmacro(ADD_ZSTD_COMPILATION_FLAGS) +endmacro() diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt index 53f72d1e..6ed6c305 100644 --- a/build/cmake/lib/CMakeLists.txt +++ b/build/cmake/lib/CMakeLists.txt @@ -105,12 +105,12 @@ if (ZSTD_LEGACY_SUPPORT) ${LIBRARY_LEGACY_DIR}/zstd_v05.h ${LIBRARY_LEGACY_DIR}/zstd_v06.h ${LIBRARY_LEGACY_DIR}/zstd_v07.h) -endif (ZSTD_LEGACY_SUPPORT) +endif () if (MSVC) set(MSVC_RESOURCE_DIR ${ZSTD_SOURCE_DIR}/build/VS2010/libzstd-dll) set(PlatformDependResources ${MSVC_RESOURCE_DIR}/libzstd-dll.rc) -endif (MSVC) +endif () # Split project to static and shared libraries build if (ZSTD_BUILD_SHARED) @@ -121,7 +121,7 @@ if (ZSTD_BUILD_SHARED) target_link_libraries(libzstd_shared ${THREADS_LIBS}) endif () endif() -endif (ZSTD_BUILD_SHARED) +endif () if (ZSTD_BUILD_STATIC) add_library(libzstd_static STATIC ${Sources} ${Headers}) if (ZSTD_MULTITHREAD_SUPPORT) @@ -130,24 +130,24 @@ if (ZSTD_BUILD_STATIC) target_link_libraries(libzstd_static ${THREADS_LIBS}) endif () endif () -endif (ZSTD_BUILD_STATIC) +endif () # Add specific compile definitions for MSVC project if (MSVC) if (ZSTD_BUILD_SHARED) set_property(TARGET libzstd_shared APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_DLL_EXPORT=1;ZSTD_HEAPMODE=0;_CONSOLE;_CRT_SECURE_NO_WARNINGS") - endif (ZSTD_BUILD_SHARED) + endif () if (ZSTD_BUILD_STATIC) set_property(TARGET libzstd_static APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_HEAPMODE=0;_CRT_SECURE_NO_WARNINGS") - endif (ZSTD_BUILD_STATIC) -endif (MSVC) + endif () +endif () # With MSVC static library needs to be renamed to avoid conflict with import library if (MSVC) set(STATIC_LIBRARY_BASE_NAME zstd_static) else () set(STATIC_LIBRARY_BASE_NAME zstd) -endif (MSVC) +endif () # Define static and shared library names if (ZSTD_BUILD_SHARED) @@ -156,14 +156,14 @@ if (ZSTD_BUILD_SHARED) PROPERTIES OUTPUT_NAME zstd SOVERSION ${LIBVER_MAJOR}.${LIBVER_MINOR}.${LIBVER_RELEASE}) -endif (ZSTD_BUILD_SHARED) +endif () if (ZSTD_BUILD_STATIC) set_target_properties( libzstd_static PROPERTIES OUTPUT_NAME ${STATIC_LIBRARY_BASE_NAME}) -endif (ZSTD_BUILD_STATIC) +endif () if (UNIX) # pkg-config @@ -178,7 +178,7 @@ if (UNIX) COMMENT "Creating pkg-config file") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libzstd.pc" DESTINATION "${LIBDIR}/pkgconfig") -endif (UNIX) +endif () # install target install(FILES @@ -196,7 +196,7 @@ if (ZSTD_BUILD_SHARED) endif() if (ZSTD_BUILD_STATIC) install(TARGETS libzstd_static ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") -endif (ZSTD_BUILD_STATIC) +endif () # uninstall target configure_file( diff --git a/build/cmake/lib/cmake_uninstall.cmake.in b/build/cmake/lib/cmake_uninstall.cmake.in index e3774dc1..9f1d045d 100644 --- a/build/cmake/lib/cmake_uninstall.cmake.in +++ b/build/cmake/lib/cmake_uninstall.cmake.in @@ -1,7 +1,7 @@ if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") -endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") +endif() file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) string(REGEX REPLACE "\n" ";" files "${files}") @@ -15,8 +15,8 @@ foreach(file ${files}) ) if(NOT "${rm_retval}" STREQUAL 0) message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") - endif(NOT "${rm_retval}" STREQUAL 0) - else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + endif() + else() message(STATUS "File $ENV{DESTDIR}${file} does not exist.") - endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") -endforeach(file) + endif() +endforeach() diff --git a/build/cmake/programs/CMakeLists.txt b/build/cmake/programs/CMakeLists.txt index 9f4e9bef..4c5146f8 100644 --- a/build/cmake/programs/CMakeLists.txt +++ b/build/cmake/programs/CMakeLists.txt @@ -19,18 +19,18 @@ include_directories(${PROGRAMS_DIR} ${LIBRARY_DIR} ${LIBRARY_DIR}/common ${LIBRA if (ZSTD_LEGACY_SUPPORT) set(PROGRAMS_LEGACY_DIR ${PROGRAMS_DIR}/legacy) include_directories(${PROGRAMS_LEGACY_DIR} ${LIBRARY_DIR}/legacy) -endif (ZSTD_LEGACY_SUPPORT) +endif () if (MSVC) set(MSVC_RESOURCE_DIR ${ZSTD_SOURCE_DIR}/build/VS2010/zstd) set(PlatformDependResources ${MSVC_RESOURCE_DIR}/zstd.rc) -endif (MSVC) +endif () add_executable(zstd ${PROGRAMS_DIR}/zstdcli.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/fileio.c ${PROGRAMS_DIR}/benchfn.c ${PROGRAMS_DIR}/benchzstd.c ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/dibio.c ${PlatformDependResources}) target_link_libraries(zstd libzstd_static) if (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)") target_link_libraries(zstd rt) -endif (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)") +endif () install(TARGETS zstd RUNTIME DESTINATION "bin") if (UNIX) @@ -53,9 +53,9 @@ if (UNIX) # Define MAN_INSTALL_DIR if necessary if (MAN_INSTALL_DIR) - else (MAN_INSTALL_DIR) + else () set(MAN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/man/man1) - endif (MAN_INSTALL_DIR) + endif () install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zstd.1 DESTINATION "${MAN_INSTALL_DIR}") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zstdcat.1 DESTINATION "${MAN_INSTALL_DIR}") @@ -66,7 +66,7 @@ if (UNIX) add_executable(zstd-frugal ${PROGRAMS_DIR}/zstdcli.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/fileio.c) target_link_libraries(zstd-frugal libzstd_static) set_property(TARGET zstd-frugal APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_NOBENCH;ZSTD_NODICT") -endif (UNIX) +endif () # Add multi-threading support definitions @@ -78,8 +78,8 @@ if (ZSTD_MULTITHREAD_SUPPORT) add_custom_target(zstdmt ALL ${CMAKE_COMMAND} -E create_symlink zstd zstdmt DEPENDS zstd COMMENT "Creating zstdmt symlink") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zstdmt DESTINATION "bin") - endif (UNIX) -endif (ZSTD_MULTITHREAD_SUPPORT) + endif () +endif () option(ZSTD_ZLIB_SUPPORT "ZLIB SUPPORT" OFF) option(ZSTD_LZMA_SUPPORT "LZMA SUPPORT" OFF) diff --git a/build/cmake/tests/CMakeLists.txt b/build/cmake/tests/CMakeLists.txt index 703e7c01..69316e28 100644 --- a/build/cmake/tests/CMakeLists.txt +++ b/build/cmake/tests/CMakeLists.txt @@ -52,4 +52,4 @@ target_link_libraries(fuzzer libzstd_static) if (UNIX) add_executable(paramgrill ${PROGRAMS_DIR}/benchfn.c ${PROGRAMS_DIR}/benchzstd.c ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/util.c ${TESTS_DIR}/paramgrill.c) target_link_libraries(paramgrill libzstd_static m) #m is math library -endif (UNIX) +endif ()