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)
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
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
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
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()
${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)
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)
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)
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
COMMENT "Creating pkg-config file")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libzstd.pc" DESTINATION "${LIBDIR}/pkgconfig")
-endif (UNIX)
+endif ()
# install target
install(FILES
endif()
if (ZSTD_BUILD_STATIC)
install(TARGETS libzstd_static ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
-endif (ZSTD_BUILD_STATIC)
+endif ()
# uninstall target
configure_file(
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}")
)
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()
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)
# 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}")
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
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)
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 ()