Thanks for the links. I've updated the relevant issue in gitlab and also added links to other related ones so that the full picture is captured more or less in one place. I'll ping the dev list to see if anyone has further updates or thoughts on the PIE picture for executables. From a very quick look, it may be non-trivial to get all compilers/platforms updated with the correct options and at least one issue talks about problems with QT and having PIE being enabled, but I'll defer to the dev list to provide further insights. You can see the updated issue with links here:
https://gitlab.kitware.com/cmake/cmake/issues/14983 On Sat, Jul 22, 2017 at 3:01 AM, Oleksii Vilchanskyi via CMake < cmake@cmake.org> wrote: > Hello, > > I would like to ask about POSITION_INDEPENDENT_CODE target property. As > of CMake 3.8.2 POSITION_INDEPENDENT_CODE appends -fPIE or -fPIC to > CMAKE_<LANG>_FLAGS and CMAKE_EXE_LINKER_FLAGS when building an executable > or a library respectively. However, to build a PIE -pie linker flag is > additionally required. Thus POSITION_INDEPENDENT_CODE is not behaving as > expected being a really easy to fix for someone aware with CMake codebase. > > Is there any reason why it wasn't added when the property was introduced? > Somebody proposed introducing POSITION_INDEPENDENT_EXECUTABLE later on in > addition to POSITION_INDEPENDENT_CODE to maintain backwards compatibility > (I suppose policies are also a solution?). > > This email is the result of the thread > <https://github.com/arsenm/sanitizers-cmake/issues/13> and the message > <https://github.com/arsenm/sanitizers-cmake/issues/13#issuecomment-315532253> > by Juan Navarro (big thanks to him), which fully summarizes CMake's > POSITION_INDEPENDENT_CODE treatment and links to multiple bugs: this one > <https://cmake.org/Bug/view.php?id=14983>, so far without attention, and this > one <https://gitlab.kitware.com/cmake/cmake/issues/16382>, resolved for > Android. > > Thank you. > > Regards, > Oleksii Vilchanskyi > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at http://www.kitware.com/ > opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake > -- Craig Scott Melbourne, Australia https://crascit.com
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake