From bb0b0c0c03120ba510f055571f72982ffda8798d 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. --- CMakeLists.txt | 6 ++++++ cmake/windows-setup.cmake | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9af783c793e..0c560bcdd2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -606,6 +606,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 aeaefc8417f..5cbfcfef634 100644 --- a/cmake/windows-setup.cmake +++ b/cmake/windows-setup.cmake @@ -118,9 +118,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)