File tree Expand file tree Collapse file tree 16 files changed +94
-76
lines changed Expand file tree Collapse file tree 16 files changed +94
-76
lines changed Original file line number Diff line number Diff line change @@ -31,5 +31,5 @@ install(
3131 TARGETS php_tsrm
3232 ARCHIVE EXCLUDE_FROM_ALL
3333 FILE_SET HEADERS
34- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /TSRM
34+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /${PHP_INCLUDE_PREFIX} / TSRM
3535)
Original file line number Diff line number Diff line change @@ -507,5 +507,5 @@ install(
507507 TARGETS zend
508508 ARCHIVE EXCLUDE_FROM_ALL
509509 FILE_SET HEADERS
510- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /Zend
510+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /${PHP_INCLUDE_PREFIX} / Zend
511511)
Original file line number Diff line number Diff line change @@ -60,6 +60,17 @@ if(NOT PHP_LAYOUT STREQUAL "GNU")
6060 # TODO: DATAROOTDIR should be "php" instead of default "share".
6161endif ()
6262
63+ set (
64+ PHP_INCLUDE_PREFIX "php"
65+ CACHE STRING
66+ "The relative directory inside the CMAKE_INSTALL_INCLUDEDIR, where to install\
67+ PHP headers. For example, 'php/${PHP_VERSION} ' to specify version or other\
68+ build-related characteristics and have multiple PHP versions installed.\
69+ Absolute paths are threated as relative; set CMAKE_INSTALL_INCLUDEDIR if\
70+ absolute path needs to be set."
71+ )
72+ mark_as_advanced (PHP_INCLUDE_PREFIX)
73+
6374set (
6475 PHP_CONFIG_FILE_SCAN_DIR ""
6576 CACHE PATH "The path where to scan for additional INI configuration files; By\
Original file line number Diff line number Diff line change @@ -24,10 +24,6 @@ include(PHP/SystemExtensions)
2424target_link_libraries (php_configuration INTERFACE PHP::SystemExtensions)
2525
2626# Set installation directories.
27- set (
28- CMAKE_INSTALL_INCLUDEDIR "include/php"
29- CACHE STRING "Include directory containing PHP header files (include/php)"
30- )
3127include (GNUInstallDirs)
3228
3329# Detect C standard library implementation.
Original file line number Diff line number Diff line change @@ -20,16 +20,13 @@ php_configure_file(
2020
2121* `VARIABLES`
2222
23- Pairs of variable names and values.
23+ Pairs of variable names and values. Variable values support generator
24+ expressions.
2425
2526 The `$<INSTALL_PREFIX>` generator expression can be used in variable values,
2627 which is replaced with installation prefix either set via the
2728 `CMAKE_INSTALL_PREFIX` variable at the configuration phase, or the `--prefix`
2829 option at the `cmake --install` phase.
29-
30- The custom PHP specific `$<PHP_EXPAND:path>` generator expression can be used
31- in variable values. It is automatically replaced to `<install-prefix>/path`
32- if `path` is relative, or to just `path` if `path` is absolute.
3330#]=============================================================================]
3431
3532include_guard (GLOBAL )
@@ -97,16 +94,6 @@ function(_php_configure_file_parse_variables)
9794
9895 list (APPEND resultVariables ${var} )
9996
100- if (value MATCHES [[^\$<PHP_EXPAND:(.*)>.*]])
101- if (IS_ABSOLUTE "${CMAKE_MATCH_1} " )
102- set (value "${CMAKE_MATCH_1} " )
103- elseif (CMAKE_MATCH_1)
104- set (value "$<INSTALL_PREFIX>/${CMAKE_MATCH_1} " )
105- else ()
106- set (value "" )
107- endif ()
108- endif ()
109-
11097 # The resultValues are for the first configure_file().
11198 if (value MATCHES [[.*\$<INSTALL_PREFIX>.*]])
11299 string (
Original file line number Diff line number Diff line change @@ -661,7 +661,7 @@ function(_php_extensions_post_configure directory)
661661 LIBRARY
662662 DESTINATION ${PHP_EXTENSION_DIR}
663663 FILE_SET HEADERS
664- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /ext /${extension}
664+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /${PHP_INCLUDE_PREFIX} / ext /${extension}
665665 )
666666
667667 # Check if extension is always enabled.
Original file line number Diff line number Diff line change @@ -45,10 +45,6 @@ template.
4545 which is replaced with installation prefix either set via the
4646 `CMAKE_INSTALL_PREFIX` variable at the configuration phase, or the `--prefix`
4747 option at the `cmake --install` phase.
48-
49- The custom PHP specific `$<PHP_EXPAND:path>` generator expression can be used
50- in variable values. It is automatically replaced to `<install-prefix>/path`
51- if `path` is relative, or to just `path` if `path` is absolute.
5248#]=============================================================================]
5349
5450include_guard (GLOBAL )
@@ -87,16 +83,6 @@ function(_pkgconfig_parse_variables variables)
8783
8884 list (APPEND result_variables ${var} )
8985
90- if (value MATCHES [[^\$<PHP_EXPAND:(.*)>.*]])
91- if (IS_ABSOLUTE "${CMAKE_MATCH_1} " )
92- set (value "${CMAKE_MATCH_1} " )
93- elseif (CMAKE_MATCH_1)
94- set (value "$<INSTALL_PREFIX>/${CMAKE_MATCH_1} " )
95- else ()
96- set (value "" )
97- endif ()
98- endif ()
99-
10086 # The result_values are for the install(CODE) and generator expression
10187 # $<INSTALL_PREFIX> works since CMake 3.27, for earlier versions the escaped
10288 # variable CMAKE_INSTALL_PREFIX can be used.
Original file line number Diff line number Diff line change @@ -93,5 +93,5 @@ install(
9393 TARGETS php_%EXTNAME%
9494 ARCHIVE EXCLUDE_FROM_ALL
9595 FILE_SET HEADERS
96- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ext/%EXTNAME%
96+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PHP_INCLUDE_PREFIX}/ ext/%EXTNAME%
9797)
Original file line number Diff line number Diff line change @@ -373,5 +373,5 @@ install(
373373 TARGETS php_main
374374 ARCHIVE EXCLUDE_FROM_ALL
375375 FILE_SET HEADERS
376- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /main
376+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /${PHP_INCLUDE_PREFIX} / main
377377)
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ install(
146146 RUNTIME
147147 DESTINATION ${CMAKE_INSTALL_BINDIR}
148148 FILE_SET HEADERS
149- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /sapi/cli
149+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /${PHP_INCLUDE_PREFIX} / sapi/cli
150150)
151151
152152install (
You can’t perform that action at this time.
0 commit comments