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