1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00
Files
CMake/Help/variable/CMAKE_POSITION_INDEPENDENT_CODE.rst
Peter Kokot 6168592f0e Help: Improve position independent code docs
This adds few adjustments for position independent code descriptions.

* CheckPIESupported:

  The output of check_pie_supported() is already logged in details by
  the try_compile event. To make the example a bit nicer to use in
  projects the message(VERBOSE) is used instead of the WARNING. In case
  of MSVC, there isn't anything to warn about as it isn't supported by
  default.

  Added intro code block showing how to include this module.

  Synced descriptions.

Fixes: #22360
2025-08-06 02:27:55 +02:00

20 lines
709 B
ReStructuredText

CMAKE_POSITION_INDEPENDENT_CODE
-------------------------------
Default value for the :prop_tgt:`POSITION_INDEPENDENT_CODE` target property.
This variable is used to initialize the
:prop_tgt:`POSITION_INDEPENDENT_CODE` property on targets that
are not ``SHARED`` or ``MODULE`` library targets.
If set, its value is also used by the :command:`try_compile` command.
The ``SHARED`` and ``MODULE`` library targets have by default position
independent code enabled regardless of this variable. To disable PIC on
these library types, only manually setting the target property disables it.
See Also
^^^^^^^^
* The :module:`CheckPIESupported` module to pass PIE-related options to the
linker for executables.