Skip to content

Conversation

@petk
Copy link
Owner

@petk petk commented Dec 16, 2024

In CMake there is common issue of naming collisions in extreme cases.

There is issue opened upstream about this at:
https://gitlab.kitware.com/cmake/cmake/-/issues/22687

Possible target name and cache variable names collisions can happen:

  • when some project is added with FetchContent, as an external project, via add_subdirectory() or similar
  • or the other way around, if PHP would be added via such mechanisms
  • if some extension would be named config, it would collide with the global PHP target php_config (aliased PHP::config)

This follows recent PHP SAPI target renames and syncs target names for PHP extensions from:
php_<extension_name> (aliased PHP::<extension_name>)
to:
php_ext_<extension_name> (aliased PHP::ext::<extension_name>)

This adds abbreviated letters to target names to better organize them in various scenarios, while still not increasing usage complexity too much.

The lower case snake_case style is used for simpler machine processing extension names and their directory names inside the php-src/ext directory.

For example, php_ext_pdo_firebird (aliased PHP::ext::pdo_firebird) might find the php-src/ext/pdo_firebird path a bit easier than CamelCase style names such as PhpExtensionPdoFirebird, PHP::Ext::PdoFirebird, etc.

Possible further adjustments following up...

In CMake there is common issue of naming collisions in extreme cases.

There is issue opened upstream about this at:
https://gitlab.kitware.com/cmake/cmake/-/issues/22687

Possible target name and cache variable names collisions can happen:
- When some project is added with `FetchContent`, as an external
  project, via `add_subdirectory()` or similar
- or the other way around, if PHP would be added via such mechanisms
- If some extension would be named `config`, it would collide with
  global PHP target `php_config` (aliased `PHP::config`).

This follows recent PHP SAPI target renames and renames target names for
PHP extensions from:
`php_<extension>` (aliased `PHP::<extension>`)
to:
`php_ext_<extension>` (aliased `PHP::ext::<extension>`)

This adds abbreviated letters to target names to better organize them
in various scenarios, while still not increasing usage complexity too
much.

Possible further adjustments following up...
@petk petk merged commit 405f61c into PHP-8.3 Dec 16, 2024
1 of 3 checks passed
@petk petk deleted the patch-naming-conventions branch December 16, 2024 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants