]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: fix `HAVE_WRITABLE_ARGV` detection
authorViktor Szakats <commit@vsz.me>
Thu, 28 Sep 2023 22:52:02 +0000 (22:52 +0000)
committerViktor Szakats <commit@vsz.me>
Fri, 29 Sep 2023 18:29:55 +0000 (18:29 +0000)
Move detection before the creation of detection results in
`curl_config.h`.

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #11978

CMakeLists.txt
lib/CMakeLists.txt

index 0ad4081fcfe1b04231b7d6a6a2b43cc33bb4a7cf..36d23c82ea40e9e14f604f8198b9c2feeef12058 100644 (file)
@@ -1255,6 +1255,18 @@ if(WIN32)
   unset(HAVE_WIN32_WINNT CACHE)
 endif()
 
+if(NOT WIN32 AND NOT CMAKE_CROSSCOMPILING)
+  # on not-Windows and not-crosscompiling, check for writable argv[]
+  include(CheckCSourceRuns)
+  check_c_source_runs("
+    int main(int argc, char **argv)
+    {
+      (void)argc;
+      argv[0][0] = ' ';
+      return (argv[0][0] == ' ')?0:1;
+    }" HAVE_WRITABLE_ARGV)
+endif()
+
 set(CMAKE_REQUIRED_FLAGS)
 
 option(ENABLE_WEBSOCKETS "Set to ON to enable EXPERIMENTAL websockets" OFF)
index 61cfb81a7b8253adaec59aba8c50fd509e2eb56d..83c0a53f286b079bd3c9d373066e2ffdee2e33b9 100644 (file)
@@ -85,19 +85,6 @@ else()
   unset(CMAKESONAME)
 endif()
 
-if(NOT WIN32 AND NOT CMAKE_CROSSCOMPILING)
-  # on not-Windows and not-crosscompiling, check for writable argv[]
-    include(CheckCSourceRuns)
-    check_c_source_runs("
-int main(int argc, char **argv)
-{
-  (void)argc;
-  argv[0][0] = ' ';
-  return (argv[0][0] == ' ')?0:1;
-}"
-      HAVE_WRITABLE_ARGV)
-endif()
-
 ## Library definition
 
 # Add "_imp" as a suffix before the extension to avoid conflicting with