STYLE: Remove CMake-language block-end command arguments

Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the block.
This is no longer the preferred style.
This commit is contained in:
Hans Johnson 2018-12-22 19:31:50 -06:00
parent 2f1ff84119
commit d3fc848ddd
6 changed files with 39 additions and 39 deletions

View File

@ -45,19 +45,19 @@ option(ZSTD_LEGACY_SUPPORT "LEGACY SUPPORT" OFF)
if (ZSTD_LEGACY_SUPPORT) if (ZSTD_LEGACY_SUPPORT)
message(STATUS "ZSTD_LEGACY_SUPPORT defined!") message(STATUS "ZSTD_LEGACY_SUPPORT defined!")
add_definitions(-DZSTD_LEGACY_SUPPORT=4) add_definitions(-DZSTD_LEGACY_SUPPORT=4)
else (ZSTD_LEGACY_SUPPORT) else ()
message(STATUS "ZSTD_LEGACY_SUPPORT not defined!") message(STATUS "ZSTD_LEGACY_SUPPORT not defined!")
add_definitions(-DZSTD_LEGACY_SUPPORT=0) add_definitions(-DZSTD_LEGACY_SUPPORT=0)
endif (ZSTD_LEGACY_SUPPORT) endif ()
# Multi-threading support # Multi-threading support
option(ZSTD_MULTITHREAD_SUPPORT "MULTITHREADING SUPPORT" ON) option(ZSTD_MULTITHREAD_SUPPORT "MULTITHREADING SUPPORT" ON)
if (ZSTD_MULTITHREAD_SUPPORT) if (ZSTD_MULTITHREAD_SUPPORT)
message(STATUS "ZSTD_MULTITHREAD_SUPPORT is enabled") message(STATUS "ZSTD_MULTITHREAD_SUPPORT is enabled")
else (ZSTD_MULTITHREAD_SUPPORT) else ()
message(STATUS "ZSTD_MULTITHREAD_SUPPORT is disabled") message(STATUS "ZSTD_MULTITHREAD_SUPPORT is disabled")
endif (ZSTD_MULTITHREAD_SUPPORT) endif ()
option(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" ON) option(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" ON)
option(ZSTD_BUILD_CONTRIB "BUILD CONTRIB" OFF) option(ZSTD_BUILD_CONTRIB "BUILD CONTRIB" OFF)
@ -77,7 +77,7 @@ if (ZSTD_MULTITHREAD_SUPPORT AND UNIX)
else() else()
message(SEND_ERROR "ZSTD currently does not support thread libraries other than pthreads") message(SEND_ERROR "ZSTD currently does not support thread libraries other than pthreads")
endif() endif()
endif (ZSTD_MULTITHREAD_SUPPORT AND UNIX) endif ()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Add source directories # Add source directories
@ -87,22 +87,22 @@ add_subdirectory(lib)
if (ZSTD_BUILD_PROGRAMS) if (ZSTD_BUILD_PROGRAMS)
if (NOT ZSTD_BUILD_STATIC) if (NOT ZSTD_BUILD_STATIC)
message(SEND_ERROR "You need to build static library to build zstd CLI") message(SEND_ERROR "You need to build static library to build zstd CLI")
endif (NOT ZSTD_BUILD_STATIC) endif ()
add_subdirectory(programs) add_subdirectory(programs)
endif (ZSTD_BUILD_PROGRAMS) endif ()
if (ZSTD_BUILD_TESTS) if (ZSTD_BUILD_TESTS)
if (NOT ZSTD_BUILD_STATIC) if (NOT ZSTD_BUILD_STATIC)
message(SEND_ERROR "You need to build static library to build tests") message(SEND_ERROR "You need to build static library to build tests")
endif (NOT ZSTD_BUILD_STATIC) endif ()
add_subdirectory(tests) add_subdirectory(tests)
endif (ZSTD_BUILD_TESTS) endif ()
if (ZSTD_BUILD_CONTRIB) if (ZSTD_BUILD_CONTRIB)
add_subdirectory(contrib) add_subdirectory(contrib)
endif (ZSTD_BUILD_CONTRIB) endif ()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Add clean-all target # Add clean-all target

View File

@ -53,7 +53,7 @@ macro(ADD_ZSTD_COMPILATION_FLAGS)
separate_arguments(${flag_var}) separate_arguments(${flag_var})
list(REMOVE_DUPLICATES ${flag_var}) list(REMOVE_DUPLICATES ${flag_var})
string(REPLACE ";" " " ${flag_var} "${${flag_var}}") string(REPLACE ";" " " ${flag_var} "${${flag_var}}")
endforeach (flag_var) endforeach ()
if (MSVC AND ZSTD_USE_STATIC_RUNTIME) if (MSVC AND ZSTD_USE_STATIC_RUNTIME)
foreach (flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE 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 CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endforeach (flag_var) endforeach ()
endif () endif ()
endmacro(ADD_ZSTD_COMPILATION_FLAGS) endmacro()

View File

@ -105,12 +105,12 @@ if (ZSTD_LEGACY_SUPPORT)
${LIBRARY_LEGACY_DIR}/zstd_v05.h ${LIBRARY_LEGACY_DIR}/zstd_v05.h
${LIBRARY_LEGACY_DIR}/zstd_v06.h ${LIBRARY_LEGACY_DIR}/zstd_v06.h
${LIBRARY_LEGACY_DIR}/zstd_v07.h) ${LIBRARY_LEGACY_DIR}/zstd_v07.h)
endif (ZSTD_LEGACY_SUPPORT) endif ()
if (MSVC) if (MSVC)
set(MSVC_RESOURCE_DIR ${ZSTD_SOURCE_DIR}/build/VS2010/libzstd-dll) set(MSVC_RESOURCE_DIR ${ZSTD_SOURCE_DIR}/build/VS2010/libzstd-dll)
set(PlatformDependResources ${MSVC_RESOURCE_DIR}/libzstd-dll.rc) set(PlatformDependResources ${MSVC_RESOURCE_DIR}/libzstd-dll.rc)
endif (MSVC) endif ()
# Split project to static and shared libraries build # Split project to static and shared libraries build
if (ZSTD_BUILD_SHARED) if (ZSTD_BUILD_SHARED)
@ -121,7 +121,7 @@ if (ZSTD_BUILD_SHARED)
target_link_libraries(libzstd_shared ${THREADS_LIBS}) target_link_libraries(libzstd_shared ${THREADS_LIBS})
endif () endif ()
endif() endif()
endif (ZSTD_BUILD_SHARED) endif ()
if (ZSTD_BUILD_STATIC) if (ZSTD_BUILD_STATIC)
add_library(libzstd_static STATIC ${Sources} ${Headers}) add_library(libzstd_static STATIC ${Sources} ${Headers})
if (ZSTD_MULTITHREAD_SUPPORT) if (ZSTD_MULTITHREAD_SUPPORT)
@ -130,24 +130,24 @@ if (ZSTD_BUILD_STATIC)
target_link_libraries(libzstd_static ${THREADS_LIBS}) target_link_libraries(libzstd_static ${THREADS_LIBS})
endif () endif ()
endif () endif ()
endif (ZSTD_BUILD_STATIC) endif ()
# Add specific compile definitions for MSVC project # Add specific compile definitions for MSVC project
if (MSVC) if (MSVC)
if (ZSTD_BUILD_SHARED) 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") 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) if (ZSTD_BUILD_STATIC)
set_property(TARGET libzstd_static APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_HEAPMODE=0;_CRT_SECURE_NO_WARNINGS") set_property(TARGET libzstd_static APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_HEAPMODE=0;_CRT_SECURE_NO_WARNINGS")
endif (ZSTD_BUILD_STATIC) endif ()
endif (MSVC) endif ()
# With MSVC static library needs to be renamed to avoid conflict with import library # With MSVC static library needs to be renamed to avoid conflict with import library
if (MSVC) if (MSVC)
set(STATIC_LIBRARY_BASE_NAME zstd_static) set(STATIC_LIBRARY_BASE_NAME zstd_static)
else () else ()
set(STATIC_LIBRARY_BASE_NAME zstd) set(STATIC_LIBRARY_BASE_NAME zstd)
endif (MSVC) endif ()
# Define static and shared library names # Define static and shared library names
if (ZSTD_BUILD_SHARED) if (ZSTD_BUILD_SHARED)
@ -156,14 +156,14 @@ if (ZSTD_BUILD_SHARED)
PROPERTIES PROPERTIES
OUTPUT_NAME zstd OUTPUT_NAME zstd
SOVERSION ${LIBVER_MAJOR}.${LIBVER_MINOR}.${LIBVER_RELEASE}) SOVERSION ${LIBVER_MAJOR}.${LIBVER_MINOR}.${LIBVER_RELEASE})
endif (ZSTD_BUILD_SHARED) endif ()
if (ZSTD_BUILD_STATIC) if (ZSTD_BUILD_STATIC)
set_target_properties( set_target_properties(
libzstd_static libzstd_static
PROPERTIES PROPERTIES
OUTPUT_NAME ${STATIC_LIBRARY_BASE_NAME}) OUTPUT_NAME ${STATIC_LIBRARY_BASE_NAME})
endif (ZSTD_BUILD_STATIC) endif ()
if (UNIX) if (UNIX)
# pkg-config # pkg-config
@ -178,7 +178,7 @@ if (UNIX)
COMMENT "Creating pkg-config file") COMMENT "Creating pkg-config file")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libzstd.pc" DESTINATION "${LIBDIR}/pkgconfig") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libzstd.pc" DESTINATION "${LIBDIR}/pkgconfig")
endif (UNIX) endif ()
# install target # install target
install(FILES install(FILES
@ -196,7 +196,7 @@ if (ZSTD_BUILD_SHARED)
endif() endif()
if (ZSTD_BUILD_STATIC) if (ZSTD_BUILD_STATIC)
install(TARGETS libzstd_static ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") install(TARGETS libzstd_static ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif (ZSTD_BUILD_STATIC) endif ()
# uninstall target # uninstall target
configure_file( configure_file(

View File

@ -1,7 +1,7 @@
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @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) file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}") string(REGEX REPLACE "\n" ";" files "${files}")
@ -15,8 +15,8 @@ foreach(file ${files})
) )
if(NOT "${rm_retval}" STREQUAL 0) if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0) endif()
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") else()
message(STATUS "File $ENV{DESTDIR}${file} does not exist.") message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") endif()
endforeach(file) endforeach()

View File

@ -19,18 +19,18 @@ include_directories(${PROGRAMS_DIR} ${LIBRARY_DIR} ${LIBRARY_DIR}/common ${LIBRA
if (ZSTD_LEGACY_SUPPORT) if (ZSTD_LEGACY_SUPPORT)
set(PROGRAMS_LEGACY_DIR ${PROGRAMS_DIR}/legacy) set(PROGRAMS_LEGACY_DIR ${PROGRAMS_DIR}/legacy)
include_directories(${PROGRAMS_LEGACY_DIR} ${LIBRARY_DIR}/legacy) include_directories(${PROGRAMS_LEGACY_DIR} ${LIBRARY_DIR}/legacy)
endif (ZSTD_LEGACY_SUPPORT) endif ()
if (MSVC) if (MSVC)
set(MSVC_RESOURCE_DIR ${ZSTD_SOURCE_DIR}/build/VS2010/zstd) set(MSVC_RESOURCE_DIR ${ZSTD_SOURCE_DIR}/build/VS2010/zstd)
set(PlatformDependResources ${MSVC_RESOURCE_DIR}/zstd.rc) 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}) 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) target_link_libraries(zstd libzstd_static)
if (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)") if (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
target_link_libraries(zstd rt) target_link_libraries(zstd rt)
endif (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)") endif ()
install(TARGETS zstd RUNTIME DESTINATION "bin") install(TARGETS zstd RUNTIME DESTINATION "bin")
if (UNIX) if (UNIX)
@ -53,9 +53,9 @@ if (UNIX)
# Define MAN_INSTALL_DIR if necessary # Define MAN_INSTALL_DIR if necessary
if (MAN_INSTALL_DIR) if (MAN_INSTALL_DIR)
else (MAN_INSTALL_DIR) else ()
set(MAN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/man/man1) 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}/zstd.1 DESTINATION "${MAN_INSTALL_DIR}")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zstdcat.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) add_executable(zstd-frugal ${PROGRAMS_DIR}/zstdcli.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/fileio.c)
target_link_libraries(zstd-frugal libzstd_static) target_link_libraries(zstd-frugal libzstd_static)
set_property(TARGET zstd-frugal APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_NOBENCH;ZSTD_NODICT") set_property(TARGET zstd-frugal APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_NOBENCH;ZSTD_NODICT")
endif (UNIX) endif ()
# Add multi-threading support definitions # 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") 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") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zstdmt DESTINATION "bin")
endif (UNIX) endif ()
endif (ZSTD_MULTITHREAD_SUPPORT) endif ()
option(ZSTD_ZLIB_SUPPORT "ZLIB SUPPORT" OFF) option(ZSTD_ZLIB_SUPPORT "ZLIB SUPPORT" OFF)
option(ZSTD_LZMA_SUPPORT "LZMA SUPPORT" OFF) option(ZSTD_LZMA_SUPPORT "LZMA SUPPORT" OFF)

View File

@ -52,4 +52,4 @@ target_link_libraries(fuzzer libzstd_static)
if (UNIX) 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) 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 target_link_libraries(paramgrill libzstd_static m) #m is math library
endif (UNIX) endif ()