You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The installation prefix is the path where the built files are copied to on the system, when doing the installation phase. In Autotools it can be set at the configure phase only. For example:
./configure --prefix=/usr
In the installation phase there is also INSTALL_ROOT to be able to temporary install the built files to a staging directory (this is in practice used on some systems where some additional pre-installation stuff is done):
make INSTALL_ROOT=/package/stage install
Here the /package/stage will then include all the built files together with the installation prefix:
Therefore it is a common-practice to use the generator expression in CMake files $<INSTALL_PREFIX> that gets properly replaced based on the different phase and its value (either in the configuration and generation phase or in the installation phase).
PHP, however, uses the prefix value also in the C header files at the build phase. For example, in main/build-defs.h or in main/php_config.h. So the prefix defined in the installation phase won't match the prefix from the configure
phase in these header files. Meaning, the cmake --install <build-dir> --prefix <prefix> is at the time of writing not handled properly in this build system yet unless some heavy refactoring is done in PHP.
Where prefix is used in PHP or in this repository files:
pkg-config templates (this is resolved in the CMake module by additionally replacing the $<INTALL_PREFIX> at the install step
php-config and some other script files generated from templates (this can be still resolved similarly to pkg-config templates by adjusting the CMake command configure_file())
main/build-defs.h.in and in various preprocessor macros, such as PHP_PREFIX, PEAR_INSTALLDIR, PHP_EXTENSION_DIR, PHP_BINDIR, PHP_LIBDIR, ... (this is very difficult to resolve properly as it would require the installation step to rebuild the C code; ideally it would be some sort of a dynamic configuration value to be read from somewhere else than being hardcoded in the header files)
The text was updated successfully, but these errors were encountered:
petk
changed the title
Installation prefix doesn't get replaced when doing cmake --install <build-dir> --prefix ...
Installation prefix isn't replaced at cmake --install <build-dir> --prefix ...Sep 18, 2024
The installation prefix is the path where the built files are copied to on the system, when doing the installation phase. In Autotools it can be set at the configure phase only. For example:
In the installation phase there is also
INSTALL_ROOT
to be able to temporary install the built files to a staging directory (this is in practice used on some systems where some additional pre-installation stuff is done):Here the
/package/stage
will then include all the built files together with the installation prefix:The PHP's
INSTALL_ROOT
is more commonly namedDESTDIR
in other Autotools and C-based projects.In CMake, the install prefix can be set at the configure phase using the
CMAKE_INSTALL_PREFIX
variable, or the--install-prefix
option:Or in the CMake presets file with the
installDir
field. For example, theCMakePresets.json
:Or it can be also overridden at the installation phase. For example:
There is also the
DESTDIR
environment variable, which acts like theINSTALL_ROOT
in PHP:Therefore it is a common-practice to use the generator expression in CMake files
$<INSTALL_PREFIX>
that gets properly replaced based on the different phase and its value (either in the configuration and generation phase or in the installation phase).PHP, however, uses the prefix value also in the C header files at the build phase. For example, in
main/build-defs.h
or inmain/php_config.h
. So the prefix defined in the installation phase won't match the prefix from the configurephase in these header files. Meaning, the
cmake --install <build-dir> --prefix <prefix>
is at the time of writing not handled properly in this build system yet unless some heavy refactoring is done in PHP.Where prefix is used in PHP or in this repository files:
$<INTALL_PREFIX>
at the install stepconfigure_file()
)The text was updated successfully, but these errors were encountered: