Red Hat Bugzilla – Bug 1264202
RFE: Add -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON to %cmake macro
Last modified: 2015-09-18 12:17:50 EDT
Description of problem:
Wrt this new change in Fedora:
I've discovered many packages which don't conform to it:
Ben Boeckel suggested on fedora-devel:
For any CMake-using projects, setting the `POSITION_INDEPENDENT_CODE` property on targets would fix any missing -fPIE. It is initialized with
`CMAKE_POSITION_INDEPENDENT_CODE`, so adding:
to %cmake when hardening is enabled should fix -fPIE missing.
The %cmake macro is defined in macros.cmake which is the CMake version
of %configure. It is part of the cmake package, so a bug there would be
I'd like to do some more research on this before adding this.
%cmake macro already sets CFLAGS/CXXFLAGS/LDFLAGS as needed, and shared library code is PIC automatically, so this is not neeed.
I did discover that LDFLAGS was not being set properly for the cmake build itself and have fixed that.