Skip to content

Commit 2dd65e1

Browse files
committed
Fix consecutive configuration phases for Bison and re2c modules
1 parent 1ea0a5f commit 2dd65e1

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

cmake/cmake/modules/PHP/Bison.cmake

+10-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ example, in command-line scripts.
7575
cmake --build <dir> --target codegen
7676
```
7777
78-
* `WORKING_DIRECTORY <directory>` - The path where the `re2c` is executed.
78+
* `WORKING_DIRECTORY <directory>` - The path where the `bison` is executed.
7979
Relative `<directory>` path is interpreted as being relative to the current
8080
binary directory. If not set, `bison` is by default executed in the
8181
`PHP_SOURCE_DIR` when building the php-src repository. Otherwise it is
@@ -288,8 +288,15 @@ function(php_bison name input output)
288288

289289
_php_bison_config()
290290

291-
# Skip consecutive calls if downloading or outer find_package() was called.
292-
if(NOT TARGET Bison::Bison AND NOT DEFINED BISON_FOUND)
291+
if(
292+
# Skip consecutive find_package() calls when:
293+
# - project calls php_bison() multiple times and Bison will be downloaded:
294+
NOT TARGET Bison::Bison
295+
# - the outer find_package() was called prior to php_bison():
296+
AND NOT DEFINED BISON_FOUND
297+
# - running consecutive configuration phases:
298+
AND NOT BISON_EXECUTABLE
299+
)
293300
find_package(BISON ${PHP_BISON_VERSION} ${quiet})
294301
endif()
295302

cmake/cmake/modules/PHP/Re2c.cmake

+9-2
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,15 @@ function(php_re2c name input output)
296296

297297
_php_re2c_config()
298298

299-
# Skip consecutive calls if downloading or outer find_package() was called.
300-
if(NOT TARGET RE2C::RE2C AND NOT DEFINED RE2C_FOUND)
299+
if(
300+
# Skip consecutive find_package() calls when:
301+
# - project calls php_re2c() multiple times and re2c will be downloaded:
302+
NOT TARGET RE2C::RE2C
303+
# - the outer find_package() was called prior to php_re2c():
304+
AND NOT DEFINED RE2C_FOUND
305+
# - running consecutive configuration phases:
306+
AND NOT RE2C_EXECUTABLE
307+
)
301308
find_package(RE2C ${PHP_RE2C_VERSION} ${quiet})
302309
endif()
303310

0 commit comments

Comments
 (0)