From c314f582541cfacec0790eebd3bdf6e130ffc29f Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 18 Apr 2021 08:22:43 +0100 Subject: [PATCH] Conditionalise a couple of CMake checks. On Windows, configure-style checks are a bit slow, so it's worth avoiding unnecessary ones if possible. I was testing for three different header file names that are alternatives to each other, so it makes sense to stop as soon as we find a usable one. --- cmake/platforms/windows.cmake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmake/platforms/windows.cmake b/cmake/platforms/windows.cmake index 0760ec67..c3f2b97f 100644 --- a/cmake/platforms/windows.cmake +++ b/cmake/platforms/windows.cmake @@ -25,8 +25,15 @@ include(CheckCSourceCompiles) set(CMAKE_REQUIRED_DEFINITIONS -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE) check_include_files("windows.h;winresrc.h" HAVE_WINRESRC_H) -check_include_files("windows.h;winres.h" HAVE_WINRES_H) -check_include_files("windows.h;win.h" HAVE_WIN_H) +if(NOT HAVE_WINRESRC_H) + # A couple of fallback names for the header file you can include in + # .rc files. We conditionalise even these checks, to save effort at + # cmake time. + check_include_files("windows.h;winres.h" HAVE_WINRES_H) + if(NOT HAVE_WINRES_H) + check_include_files("windows.h;win.h" HAVE_WIN_H) + endif() +endif() check_include_files("stdint.h" HAVE_STDINT_H) define_negation(HAVE_NO_STDINT_H HAVE_STDINT_H)