aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViktor Szakats <commit@vsz.me>2024-05-16 02:56:37 +0200
committerViktor Szakats <commit@vsz.me>2024-05-16 17:22:08 +0200
commit9e2bd56ec61c03868fb8d777bfd5fe3602f9ddf5 (patch)
tree2b89bc16c787634a17606fcb47317a05726df1df
parent9b802e2d1930961a7305eac2c63679de0fe80176 (diff)
downloadcurl-9e2bd56ec61c03868fb8d777bfd5fe3602f9ddf5.tar.gz
cmake: initialize `BUILD_TESTING` before first use
Before this patch `BUILD_TESTING` was used once, then initialized, then used again. This caused the `curlu` library not being built when relying on an implicit `BUILD_TESTING=ON` setting, and ending up with a link error when building the `testdeps` target. It did not cause issues when `BUILD_TESTING` was explicitly set. Move the initialization before the first use to fix it. Regression from aace27b0965c10394544d1dacc9c2cb2fe0de3d3 #12287 Closes #13668
-rw-r--r--CMakeLists.txt7
1 files changed, 4 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 149b5a5d4..f27920660 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1565,6 +1565,10 @@ set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
+cmake_dependent_option(BUILD_TESTING "Build tests"
+ ON "PERL_FOUND;NOT CURL_DISABLE_TESTS"
+ OFF)
+
if(HAVE_MANUAL_TOOLS)
add_subdirectory(docs)
endif()
@@ -1580,9 +1584,6 @@ if(BUILD_EXAMPLES)
add_subdirectory(docs/examples)
endif()
-cmake_dependent_option(BUILD_TESTING "Build tests"
- ON "PERL_FOUND;NOT CURL_DISABLE_TESTS"
- OFF)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()