From 7cbee1690d0d52dbd57fbfda1506fa1a0b1a3d37 Mon Sep 17 00:00:00 2001 From: Craig Ringer Date: Wed, 24 May 2023 11:21:51 +1200 Subject: [PATCH] build: windows: Eagerly fail on missing openssl or flex Windows builds will fail if flex, bison or the OpenSSL libraries are missing. So modify the CMake code to ensure that we fail at CMake time, rather than during the subsequent build. Signed-off-by: Craig Ringer --- CMakeLists.txt | 6 ++++++ cmake/windows-setup.cmake | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 38f963a60e8..4ab7485e59b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -621,6 +621,12 @@ if(FLB_TLS) if(OPENSSL_FOUND) FLB_DEFINITION(FLB_HAVE_OPENSSL) endif() + + if (FLB_SYSTEM_WINDOWS AND NOT(OPENSSL_FOUND)) + # win32 builds w/o openssl will fail later so we might as well catch it + # early instead. + MESSAGE(FATAL_ERROR "OpenSSL required on Windows, see DEVELOPER_GUIDE.md") + endif() endif() # Metrics diff --git a/cmake/windows-setup.cmake b/cmake/windows-setup.cmake index fa67cb0d872..4f57880a48b 100644 --- a/cmake/windows-setup.cmake +++ b/cmake/windows-setup.cmake @@ -119,9 +119,10 @@ find_package(FLEX) find_package(BISON) if (NOT (${FLEX_FOUND} AND ${BISON_FOUND})) - message(STATUS "flex and bison not found. Disable stream_processor building.") - set(FLB_STREAM_PROCESSOR No) - set(FLB_RECORD_ACCESSOR No) + # The build will fail later if flex and bison are missing, so there's no + # point attempting to continue. There's no test cover for windows builds + # without FLB_PARSER anyway. + message(FATAL_ERROR "flex and bison not found, see DEVELOPER_GUIDE.md") endif() if (MSVC)