No. CMAKE_<lang>_LINK_OPTIONS_NO_PIE is not used by default. If POSITION_INDEPENDENT_CODE is not set (TRUE or FALSE), no flags are applied to link step.
PIE flag (-fpie or -fno_pie) is applied only if property POSITION_INDEPENDENT_CODE is set (‘TRUE’ or ‘FALSE’).
To ensure consistency for the link step, define the variable CMAKE_POSITION_INDEPENDENT_CODE and include module CheckPIESupport in the root CMakelist.txt and call check_pie_supported().
variable CMAKE_POSITION_INDEPENDENT_CODE can take TRUE or FALSE:
- set to
FALSE:gccandispcwill compile in their default mode (PICfor gcc andNO_PICfor ispc) but the linker will specify-fno_pieso link will succeed. - set to
TRUE:gccandispcwill compile with option-fPICand the linker will use option-fpieand the link will succeed.