summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2018-10-02 15:34:57 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2018-11-11 16:34:09 (GMT)
commitc4b4d8b3a67718e29edb5676273e528dab566672 (patch)
treeddb8839ae8a5a15b5ffe8dd8190cf873841475da /Help
parent724a0346f7bd424ce0e5db246cee46db9f377a6f (diff)
downloadCMake-c4b4d8b3a67718e29edb5676273e528dab566672.zip
CMake-c4b4d8b3a67718e29edb5676273e528dab566672.tar.gz
CMake-c4b4d8b3a67718e29edb5676273e528dab566672.tar.bz2
POSITION_INDEPENDENT_CODE: Manage link flags for executables
Fixes: #14983, #16561
Diffstat (limited to 'Help')
-rw-r--r--Help/manual/cmake-policies.7.rst1
-rw-r--r--Help/policy/CMP0083.rst24
-rw-r--r--Help/release/dev/link-option-PIE.rst6
3 files changed, 31 insertions, 0 deletions
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 0587429..98279ef 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -57,6 +57,7 @@ Policies Introduced by CMake 3.14
.. toctree::
:maxdepth: 1
+ CMP0083: Add PIE options when linking executable. </policy/CMP0083>
CMP0082: Install rules from add_subdirectory() are interleaved with those in caller. </policy/CMP0082>
Policies Introduced by CMake 3.13
diff --git a/Help/policy/CMP0083.rst b/Help/policy/CMP0083.rst
new file mode 100644
index 0000000..7b467b0
--- /dev/null
+++ b/Help/policy/CMP0083.rst
@@ -0,0 +1,24 @@
+CMP0083
+-------
+
+To control generation of Position Independent Executable (``PIE``) or not, some
+flags are required at link time.
+
+CMake 3.13 and lower did not add these link flags when
+:prop_tgt:`POSITION_INDEPENDENT_CODE` is set.
+
+The ``OLD`` behavior for this policy is to not manage ``PIE`` link flags. The
+``NEW`` behavior is to add link flags if :prop_tgt:`POSITION_INDEPENDENT_CODE`
+is set:
+
+* Set to ``TRUE``: flags to produce a position independent executable are
+ passed to the linker step. For example ``-pie`` for ``GCC``.
+* Set to ``FALSE``: flags not to produce a position independent executable are
+ passed to the linker step. For example ``-no-pie`` for ``GCC``.
+* Not set: no flags are passed to the linker step.
+
+This policy was introduced in CMake version 3.14. CMake version
+|release| warns when the policy is not set and uses ``OLD`` behavior. Use
+the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/release/dev/link-option-PIE.rst b/Help/release/dev/link-option-PIE.rst
new file mode 100644
index 0000000..824ab2c
--- /dev/null
+++ b/Help/release/dev/link-option-PIE.rst
@@ -0,0 +1,6 @@
+link-option-PIE
+---------------
+
+* Required link options to manage Position Independent Executable are now
+ added when :prop_tgt:`POSITION_INDEPENDENT_CODE` is set. These flags are
+ controlled by policy :policy:`CMP0083`.