[cmake-developers] [CMake 0014983]: POSITION_INDEPENDENT_CODE does not add -pie

Mantis Bug Tracker mantis at public.kitware.com
Fri Jun 20 07:19:26 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14983 
====================================================================== 
Reported By:                Ludwig Nussel
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14983
Category:                   CMake
Reproducibility:            have not tried
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-06-20 07:19 EDT
Last Modified:              2014-06-20 07:19 EDT
====================================================================== 
Summary:                    POSITION_INDEPENDENT_CODE does not add -pie
Description: 
I tried to make wodim a position independent executable to comply with distro
policies. I did that by adding this to CMakeLists.txt:
SET_TARGET_PROPERTIES(wodim PROPERTIES POSITION_INDEPENDENT_CODE TRUE)

That however does not set -pie for the linker flags so no actual pie binary is
created. An extra "LINK_FLAGS -pie" is necessary. I guess that's not the
intention of the abstraction.


Steps to Reproduce: 
SET_TARGET_PROPERTIES(wodim PROPERTIES POSITION_INDEPENDENT_CODE TRUE)

should result in

$ readelf -h wodim|grep Type:
  Type:                              DYN (Shared object file)

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-06-20 07:19 Ludwig Nussel  New Issue                                    
======================================================================



More information about the cmake-developers mailing list