Skip to content

Commit 6d8fa4e

Browse files
committed
Add C++ check when downloading re2c
To build re2c from scratch, also C++ compiler is required. This checks whether the C++ compiler is available and C++ can be enabled. If not, it emits fatal error early to not fail later in the build phase.
1 parent e70b206 commit 6d8fa4e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cmake/cmake/modules/PHP/Re2c.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,18 @@ function(_php_re2c_download)
599599
return(PROPAGATE RE2C_FOUND RE2C_VERSION)
600600
endif()
601601

602+
# C++ is required when building re2c from source.
603+
include(CheckLanguage)
604+
check_language(CXX)
605+
if(NOT CMAKE_CXX_COMPILER)
606+
message(
607+
FATAL_ERROR
608+
"The re2c was not found on the system and will be downloaded at build "
609+
"phase. To build re2c from source also C++ compiler is required. Please, "
610+
"install missing C++ compiler or install re2c manually."
611+
)
612+
endif()
613+
602614
message(STATUS "Re2c ${RE2C_VERSION} will be downloaded at build phase")
603615

604616
include(ExternalProject)

0 commit comments

Comments
 (0)