From: Nathan Moinvaziri Date: Sun, 20 Sep 2020 19:22:44 +0000 (-0700) Subject: Combine option and add_feature_info in CMake. X-Git-Tag: v2.0.0-RC1~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1da1491609c313eafbe6832d6cf024035f6261e6;p=thirdparty%2Fzlib-ng.git Combine option and add_feature_info in CMake. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c707e77d..8f522b0c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,39 +72,44 @@ endif() # # Options parsing # -option(WITH_GZFILEOP "Compile with support for gzFile related functions" ON) -option(ZLIB_COMPAT "Compile with zlib compatible API" OFF) -option(ZLIB_ENABLE_TESTS "Build test binaries" ON) -option(ZLIB_DUAL_LINK "Dual link tests against system zlib" OFF) -option(WITH_SANITIZERS "Build with address sanitizer and all supported sanitizers other than memory sanitizer" OFF) -option(WITH_MSAN "Build with memory sanitizer" OFF) -option(WITH_FUZZERS "Build test/fuzz" OFF) -option(WITH_OPTIM "Build with optimisation" ON) -option(WITH_NEW_STRATEGIES "Use new strategies" ON) -option(WITH_NATIVE_INSTRUCTIONS +macro(add_option name description value) + option(${name} ${description} ${value}) + add_feature_info(${name} ${name} ${description}) +endmacro() + +add_option(WITH_GZFILEOP "Compile with support for gzFile related functions" ON) +add_option(ZLIB_COMPAT "Compile with zlib compatible API" OFF) +add_option(ZLIB_ENABLE_TESTS "Build test binaries" ON) +add_option(ZLIB_DUAL_LINK "Dual link tests against system zlib" OFF) +add_option(WITH_SANITIZERS "Build with address sanitizer and all supported sanitizers other than memory sanitizer" OFF) +add_option(WITH_MSAN "Build with memory sanitizer" OFF) +add_option(WITH_FUZZERS "Build test/fuzz" OFF) +add_option(WITH_OPTIM "Build with optimisation" ON) +add_option(WITH_NEW_STRATEGIES "Use new strategies" ON) +add_option(WITH_NATIVE_INSTRUCTIONS "Instruct the compiler to use the full instruction set on this host (gcc/clang -march=native)" OFF) -option(WITH_MAINTAINER_WARNINGS "Build with project maintainer warnings" OFF) -option(WITH_CODE_COVERAGE "Enable code coverage reporting" OFF) -option(WITH_INFLATE_STRICT "Build with strict inflate distance checking" OFF) -option(WITH_INFLATE_ALLOW_INVALID_DIST "Build with zero fill for inflate invalid distances" OFF) -option(WITH_UNALIGNED "Support unaligned reads on platforms that support it" ON) +add_option(WITH_MAINTAINER_WARNINGS "Build with project maintainer warnings" OFF) +add_option(WITH_CODE_COVERAGE "Enable code coverage reporting" OFF) +add_option(WITH_INFLATE_STRICT "Build with strict inflate distance checking" OFF) +add_option(WITH_INFLATE_ALLOW_INVALID_DIST "Build with zero fill for inflate invalid distances" OFF) +add_option(WITH_UNALIGNED "Support unaligned reads on platforms that support it" ON) if(BASEARCH_ARM_FOUND) - option(WITH_ACLE "Build with ACLE" ON) - option(WITH_NEON "Build with NEON intrinsics" ON) + add_option(WITH_ACLE "Build with ACLE" ON) + add_option(WITH_NEON "Build with NEON intrinsics" ON) elseif(BASEARCH_PPC_FOUND) - option(WITH_POWER8 "Build with optimisations for POWER8" ON) + add_option(WITH_POWER8 "Build with optimisations for POWER8" ON) elseif(BASEARCH_S360_FOUND) - option(WITH_DFLTCC_DEFLATE "Use DEFLATE CONVERSION CALL instruction for compression on IBM Z" OFF) - option(WITH_DFLTCC_INFLATE "Use DEFLATE CONVERSION CALL instruction for decompression on IBM Z" OFF) + add_option(WITH_DFLTCC_DEFLATE "Use DEFLATE CONVERSION CALL instruction for compression on IBM Z" OFF) + add_option(WITH_DFLTCC_INFLATE "Use DEFLATE CONVERSION CALL instruction for decompression on IBM Z" OFF) elseif(BASEARCH_X86_FOUND) - option(WITH_AVX2 "Build with AVX2" ON) - option(WITH_SSE2 "Build with SSE2" ON) - option(WITH_SSSE3 "Build with SSSE3" ON) - option(WITH_SSE4 "Build with SSE4" ON) - option(WITH_PCLMULQDQ "Build with PCLMULQDQ" ON) + add_option(WITH_AVX2 "Build with AVX2" ON) + add_option(WITH_SSE2 "Build with SSE2" ON) + add_option(WITH_SSSE3 "Build with SSSE3" ON) + add_option(WITH_SSE4 "Build with SSE4" ON) + add_option(WITH_PCLMULQDQ "Build with PCLMULQDQ" ON) endif() -option(INSTALL_UTILS "Copy minigzip and minideflate during install" OFF) +add_option(INSTALL_UTILS "Copy minigzip and minideflate during install" OFF) mark_as_advanced(FORCE ZLIB_DUAL_LINK @@ -121,22 +126,6 @@ mark_as_advanced(FORCE INSTALL_UTILS ) -add_feature_info(ZLIB_COMPAT ZLIB_COMPAT "Provide a zlib-compatible API") -add_feature_info(WITH_GZFILEOP WITH_GZFILEOP "Compile with support for gzFile-related functions") -add_feature_info(WITH_OPTIM WITH_OPTIM "Build with optimisation") -add_feature_info(WITH_SANITIZERS WITH_SANITIZERS "Build with address sanitizer and all supported sanitizers other than memory sanitizer") -add_feature_info(WITH_MSAN WITH_MSAN "Build with memory sanitizer") -add_feature_info(WITH_FUZZERS WITH_FUZZERS "Build test/fuzz") -add_feature_info(WITH_NEW_STRATEGIES WITH_NEW_STRATEGIES "Use new strategies") -if(BASEARCH_ARM_FOUND) - add_feature_info(WITH_ACLE WITH_ACLE "Build with ACLE CRC") - add_feature_info(WITH_NEON WITH_NEON "Build with NEON intrinsics") -elseif(BASEARCH_PPC_FOUND) - add_feature_info(WITH_POWER8 WITH_POWER8 "Build with optimisations for POWER8") -endif() -add_feature_info(WITH_MAINTAINER_WARNINGS WITH_MAINTAINER_WARNINGS "Build with project maintainer warnings") -add_feature_info(WITH_CODE_COVERAGE WITH_CODE_COVERAGE "Enable code coverage reporting") - if(ZLIB_COMPAT) add_definitions(-DZLIB_COMPAT) set(WITH_GZFILEOP ON)