CMake: Try to set a required try_run() definition in a more idiomatic way
This is applicable to every test (if we had more), not just HAVE_C99_VSNPRINTF. Could also be a #define but let's go with this for now. This takes advantage of the stack based design of CMakePushCheckState.
This commit is contained in:
parent
9bce34ca67
commit
fa525649be
|
@ -472,6 +472,7 @@ if(MINGW)
|
||||||
#
|
#
|
||||||
-D_POSIX
|
-D_POSIX
|
||||||
)
|
)
|
||||||
|
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_POSIX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( CMAKE_C_COMPILER_ID MATCHES "MSVC")
|
if( CMAKE_C_COMPILER_ID MATCHES "MSVC")
|
||||||
|
|
|
@ -107,10 +107,6 @@ check_symbol_exists(tzname "time.h" HAVE_TZNAME)
|
||||||
# Check if the libc vsnprintf() conforms to C99. If this fails we may
|
# Check if the libc vsnprintf() conforms to C99. If this fails we may
|
||||||
# need to fall-back on GLib I/O.
|
# need to fall-back on GLib I/O.
|
||||||
#
|
#
|
||||||
cmake_push_check_state(RESET)
|
|
||||||
if(MINGW)
|
|
||||||
set(CMAKE_REQUIRED_DEFINITIONS -D__USE_MINGW_ANSI_STDIO)
|
|
||||||
endif()
|
|
||||||
check_c_source_runs("
|
check_c_source_runs("
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
int main(void)
|
int main(void)
|
||||||
|
@ -124,7 +120,6 @@ check_c_source_runs("
|
||||||
}"
|
}"
|
||||||
HAVE_C99_VSNPRINTF
|
HAVE_C99_VSNPRINTF
|
||||||
)
|
)
|
||||||
cmake_pop_check_state()
|
|
||||||
if (NOT HAVE_C99_VSNPRINTF)
|
if (NOT HAVE_C99_VSNPRINTF)
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR
|
||||||
"Building Wireshark requires a C99 compliant vsnprintf() and this \
|
"Building Wireshark requires a C99 compliant vsnprintf() and this \
|
||||||
|
|
Loading…
Reference in New Issue