cmake/Help/policy/CMP0018.rst

36 lines
1.6 KiB
ReStructuredText
Raw Normal View History

2014-08-03 19:52:23 +02:00
CMP0018
-------
2019-11-11 23:01:05 +01:00
Ignore ``CMAKE_SHARED_LIBRARY_<Lang>_FLAGS`` variable.
2014-08-03 19:52:23 +02:00
2019-11-11 23:01:05 +01:00
CMake 2.8.8 and lower compiled sources in ``SHARED`` and ``MODULE`` libraries
using the value of the undocumented ``CMAKE_SHARED_LIBRARY_<Lang>_FLAGS``
2014-08-03 19:52:23 +02:00
platform variable. The variable contained platform-specific flags
needed to compile objects for shared libraries. Typically it included
2019-11-11 23:01:05 +01:00
a flag such as ``-fPIC`` for position independent code but also included
2014-08-03 19:52:23 +02:00
other flags needed on certain platforms. CMake 2.8.9 and higher
2019-11-11 23:01:05 +01:00
prefer instead to use the :prop_tgt:`POSITION_INDEPENDENT_CODE` target
property to determine what targets should be position independent, and new
2014-08-03 19:52:23 +02:00
undocumented platform variables to select flags while ignoring
2019-11-11 23:01:05 +01:00
``CMAKE_SHARED_LIBRARY_<Lang>_FLAGS`` completely.
2014-08-03 19:52:23 +02:00
The default for either approach produces identical compilation flags,
2019-11-11 23:01:05 +01:00
but if a project modifies ``CMAKE_SHARED_LIBRARY_<Lang>_FLAGS`` from its
2014-08-03 19:52:23 +02:00
original value this policy determines which approach to use.
2019-11-11 23:01:05 +01:00
The ``OLD`` behavior for this policy is to ignore the
:prop_tgt:`POSITION_INDEPENDENT_CODE` property for all targets and use the
modified value of ``CMAKE_SHARED_LIBRARY_<Lang>_FLAGS`` for ``SHARED`` and
``MODULE`` libraries.
2014-08-03 19:52:23 +02:00
2019-11-11 23:01:05 +01:00
The ``NEW`` behavior for this policy is to ignore
``CMAKE_SHARED_LIBRARY_<Lang>_FLAGS`` whether it is modified or not and
honor the :prop_tgt:`POSITION_INDEPENDENT_CODE` target property.
2014-08-03 19:52:23 +02:00
This policy was introduced in CMake version 2.8.9. CMake version
2019-11-11 23:01:05 +01:00
|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.
2015-08-17 11:37:30 +02:00
.. include:: DEPRECATED.txt