]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Respect the conventional BUILD_TESTS CMake option on the first configure
authorTaylor Braun-Jones <taylor@braun-jones.org>
Mon, 23 Mar 2020 21:44:27 +0000 (17:44 -0400)
committerTaylor Braun-Jones <taylor@braun-jones.org>
Mon, 23 Mar 2020 21:49:04 +0000 (17:49 -0400)
build/cmake/CMakeLists.txt

index be5ce15186f814fb498a78f8f1682e79e1e94035..70e8c0609ec9b384de202a5328dd0091fed1c9c2 100644 (file)
@@ -103,7 +103,14 @@ endif ()
 
 option(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" ON)
 option(ZSTD_BUILD_CONTRIB "BUILD CONTRIB" OFF)
-option(ZSTD_BUILD_TESTS "BUILD TESTS" OFF)
+
+# Respect the conventional CMake option for enabling tests if it was specified on the first configure
+if (BUILD_TESTING)
+    set(ZSTD_BUILD_TESTS_default ON)
+else()
+    set(ZSTD_BUILD_TESTS_default OFF)
+endif()
+option(ZSTD_BUILD_TESTS "BUILD TESTS" ${ZSTD_BUILD_TESTS_default})
 if (MSVC)
     option(ZSTD_USE_STATIC_RUNTIME "LINK TO STATIC RUN-TIME LIBRARIES" OFF)
 endif ()