Skip to content

Commit

Permalink
Fix globbing inconsistencies
Browse files Browse the repository at this point in the history
Glob behaves differently on case-insensitive file systems such as on
Windows and macOS. Otherwise here also the credits shell script is
fetched.
  • Loading branch information
petk committed Dec 11, 2024
1 parent fd09510 commit 0aa3411
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/init.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Usage:
cmake -P bin/init.cmake
#]=============================================================================]

cmake_minimum_required(VERSION 3.25)
cmake_minimum_required(VERSION 3.25...3.31)

if(NOT CMAKE_SCRIPT_MODE_FILE)
message(FATAL_ERROR "This is a command-line script.")
Expand Down
2 changes: 1 addition & 1 deletion bin/php.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Usage examples:
./bin/php.cmake
#]=============================================================================]

cmake_minimum_required(VERSION 3.25)
cmake_minimum_required(VERSION 3.25...3.31)

if(NOT CMAKE_SCRIPT_MODE_FILE)
message(FATAL_ERROR "This is a command-line script.")
Expand Down
1 change: 0 additions & 1 deletion cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ include(cmake/CMakeDefaults.cmake)

message(STATUS "Initializing PHP build system")
message(STATUS "=============================")

message(STATUS "CMake version: ${CMAKE_VERSION}")
message(STATUS "CMake generator: ${CMAKE_GENERATOR}")

Expand Down
6 changes: 4 additions & 2 deletions cmake/cmake/scripts/GenerateCredits.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ set(template [[
]])

file(GLOB credits ${PHP_SOURCE_DIR}/*/*/CREDITS)
# Case-sensitive filtering, GLOB on macOS/Windows is case-insensitive.
list(FILTER credits INCLUDE REGEX ".*CREDITS$")

foreach(credit ${credits})
foreach(credit IN LISTS credits)
cmake_path(GET credit PARENT_PATH dir)
cmake_path(GET dir PARENT_PATH dir)
cmake_path(GET dir FILENAME dir)
Expand All @@ -46,7 +48,7 @@ endforeach()

list(REMOVE_DUPLICATES dirs)

foreach(dir ${dirs})
foreach(dir IN LISTS dirs)
list(SORT ${dir}_credits CASE INSENSITIVE)
list(JOIN ${dir}_credits ";\n" content)
set(content "${template}${content};\n")
Expand Down
2 changes: 2 additions & 0 deletions cmake/ext/standard/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ check_symbol_exists(

block()
file(GLOB credits ${PHP_SOURCE_DIR}/*/*/CREDITS)
# Case-sensitive filtering, GLOB on macOS/Windows is case-insensitive.
list(FILTER credits INCLUDE REGEX ".*CREDITS$")

# The CODEGEN keyword adds the custom command to a global 'codegen' target.
set(codegen "")
Expand Down

0 comments on commit 0aa3411

Please sign in to comment.