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
This commit is contained in:
Viktor Szakats 2023-09-28 22:52:02 +00:00
parent 69aa8f6de4
commit ca7daadd9b
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
2 changed files with 12 additions and 13 deletions

View 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)

View 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