From: Viktor Szakats Date: Thu, 28 Sep 2023 22:52:02 +0000 (+0000) Subject: cmake: fix `HAVE_WRITABLE_ARGV` detection X-Git-Tag: curl-8_4_0~77 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ca7daadd9b6e7c68607a53c48dd8ab2a753306f0;p=thirdparty%2Fcurl.git cmake: fix `HAVE_WRITABLE_ARGV` detection Move detection before the creation of detection results in `curl_config.h`. Ref: #11964 (effort to sync cmake detections with autotools) Closes #11978 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ad4081fcf..36d23c82ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 61cfb81a7b..83c0a53f28 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -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