Skip to content

Commit b3661aa

Browse files
committed
Refactor PIC configuration
Documentation related changes have been sent upstream instead of describing things in the module. The PHP/PositionIndependentCode module is also redundant and not necessary. For now PIC configuration is simplified here until more fine tuning will be needed if ever. Additionally, the LINK_LIBRARIES target property for ext/standard internal functions targets are redundant as CMake 4.1 evaluates this property transitively now. And for object libraries they are also not needed anyway.
1 parent ca7d9b9 commit b3661aa

File tree

4 files changed

+7
-49
lines changed

4 files changed

+7
-49
lines changed

cmake/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ define_property(
8080
# Check whether IPO/LTO can be enabled.
8181
include(PHP/Optimization)
8282

83-
# Set CMAKE_POSITION_INDEPENDENT_CODE.
84-
include(PHP/PositionIndependentCode)
83+
include(CheckPIESupported)
84+
check_pie_supported()
8585

8686
# Configure build types.
8787
include(cmake/BuildTypes.cmake)

cmake/cmake/CMakeDefaults.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,8 @@ mark_as_advanced(CMAKE_COMPILE_WARNING_AS_ERROR)
4747
# Set default visibility of all symbols to hidden if the compiler (for example,
4848
# GCC >= 4) supports it. This can help reduce the binary size and startup time.
4949
set(CMAKE_C_VISIBILITY_PRESET "hidden")
50+
51+
# Enable position-independent code (PIC) for all targets.
52+
if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
53+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
54+
endif()

cmake/cmake/modules/PHP/PositionIndependentCode.cmake

Lines changed: 0 additions & 46 deletions
This file was deleted.

cmake/ext/standard/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,6 @@ set_target_properties(
478478
PROPERTIES
479479
INCLUDE_DIRECTORIES $<TARGET_PROPERTY:php_ext_standard,INCLUDE_DIRECTORIES>
480480
COMPILE_DEFINITIONS $<TARGET_PROPERTY:php_ext_standard,COMPILE_DEFINITIONS>
481-
LINK_LIBRARIES $<TARGET_PROPERTY:php_ext_standard,LINK_LIBRARIES>
482481
)
483482

484483
target_compile_definitions(

0 commit comments

Comments
 (0)