authorgravatar for sentrycraft123@gmail.comJan200101 <sentrycraft123@gmail.com> 2024-05-26 15:13:33+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-11 17:07:54+02:00
log41dbd0d0da0989495a97e99fb9269a49ac302768
tree18a043e574ada883a6d01738f387cc6f5486a0e3
parent901f344be2fb822df2c431017833899450779c4d

cmake: correct PIE support detection, add error output for debugging

`check_pie_supported` only uses the `OUTPUT_VARIABLE` to to signify errors if PIE is actually supported is signaled by `CMAKE_<lang>_LINK_PIE_SUPPORTED`. Checking if `OUTPUT_VARIABLE` is empty is not enough either since the check is bypassed if its results are cached but the output variable is not cached.

1 files changed, 2 insertions(+), 2 deletions(-)

CMakeLists.txt+2-2
......@@ -125,8 +125,8 @@ check_pie_supported(
125125 OUTPUT_VARIABLE ZIG_PIE_SUPPORTED_BY_CMAKE
126126 LANGUAGES C CXX
127127)
128if(ZIG_PIE AND NOT ZIG_PIE_SUPPORTED_BY_CMAKE)
129 message(SEND_ERROR "ZIG_PIE was requested but CMake does not support it for \"zigcpp\" target")
128if(ZIG_PIE AND NOT CMAKE_CXX_LINK_PIE_SUPPORTED)
129 message(SEND_ERROR "ZIG_PIE was requested but CMake does not support it for \"zigcpp\" target: ${ZIG_PIE_SUPPORTED_BY_CMAKE}")
130130endif()
131131
132132