Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions cmake/ExpressionLanguage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ if(WIN32)

set(BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")

set(PATCH_FILE "${CMAKE_SOURCE_DIR}/thirdparty/winflexbison/minimum_cmake_version.patch")

set(PC ${Bash_EXECUTABLE} -c "set -x &&\
(\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE}\\\")")

FetchContent_Declare(
winflexbison
URL "https://github.com/lexxmark/winflexbison/archive/refs/tags/v2.5.25.tar.gz"
URL_HASH "SHA256=8e1b71e037b524ba3f576babb0cf59182061df1f19cd86112f085a882560f60b"
PATCH_COMMAND "${PC}"
SYSTEM
)
FetchContent_GetProperties("winflexbison")
Expand All @@ -38,6 +44,10 @@ if(WIN32)
ERROR_VARIABLE bisonbuildE
)

if(NOT result EQUAL 0)
message(FATAL_ERROR "configuration failed for winflexbison:\n${bisonbuildE}")
endif()
Comment on lines 44 to +49
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use COMMAND_ERROR_IS_FATAL instead of RESULT_VARIABLE, OUTPUT_VARIABLE and ERROR_VARIABLE?


execute_process(
COMMAND ${CMAKE_COMMAND} --build . --config RelWithDebInfo
WORKING_DIRECTORY ${winflexbison_SOURCE_DIR}
Expand All @@ -46,6 +56,10 @@ if(WIN32)
ERROR_VARIABLE bisonbuildE
)

if(NOT result EQUAL 0)
message(FATAL_ERROR "winflexbison build failed:\n${bisonbuildE}")
endif()

file(COPY ${winflexbison_SOURCE_DIR}/bison/Data DESTINATION ${winflexbison_SOURCE_DIR}/bison/RelWithDebInfo/)
endif()

Expand Down
40 changes: 40 additions & 0 deletions thirdparty/winflexbison/minimum_cmake_version.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cf657a6..8757b14 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

project (winflexbison)

diff --git a/bison/CMakeLists.txt b/bison/CMakeLists.txt
index 55de8a1..24bbdcd 100644
--- a/bison/CMakeLists.txt
+++ b/bison/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

set(PROJECT_NAME win_bison)

diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 4b57c62..6a292fa 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

set(PROJECT_NAME winflexbison_common)

diff --git a/flex/CMakeLists.txt b/flex/CMakeLists.txt
index f634f81..02ba17a 100644
--- a/flex/CMakeLists.txt
+++ b/flex/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

set(PROJECT_NAME win_flex)

Loading