Commit 1604be06685312f659675f3bc17b287108e00af1

Edward Thomson 2021-11-17T08:54:38

Merge pull request #6120 from libgit2/ethomson/cmake_test cmake: re-enable WinHTTP

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 664abc0..c414bbe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -111,6 +111,7 @@ include(DefaultCFlags)
 add_subdirectory(src)
 
 if(BUILD_TESTS)
+	enable_testing()
 	add_subdirectory(tests)
 endif()
 
diff --git a/cmake/SelectWinHTTP.cmake b/cmake/SelectWinHTTP.cmake
index 1d950c9..667b400 100644
--- a/cmake/SelectWinHTTP.cmake
+++ b/cmake/SelectWinHTTP.cmake
@@ -1,4 +1,4 @@
-if(WIN32 AND WINHTTP)
+if(WIN32 AND USE_WINHTTP)
 	set(GIT_WINHTTP 1)
 
 	# Since MinGW does not come with headers or an import library for winhttp,
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index b42359a..84df92a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -68,8 +68,6 @@ function(ADD_CLAR_TEST name)
 	endif()
 endfunction(ADD_CLAR_TEST)
 
-enable_testing()
-
 add_clar_test(offline             -v -xonline)
 add_clar_test(invasive            -v -score::ftruncate -sfilter::stream::bigfile -sodb::largefiles -siterator::workdir::filesystem_gunk -srepo::init -srepo::init::at_filesystem_root)
 add_clar_test(online              -v -sonline -xonline::customcert)