Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1ba9129 Add policy CMP0068 separate install_name and RPATH settings on macOS f7b9bf4 Apple: Add BUILD_WITH_INSTALL_NAME_DIR target property 4bff2d1 Apple: Refactor support for using INSTALL_NAME_DIR. 624fb9d Help: Format BUILD_WITH_INSTALL_RPATH documentation
- Loading branch information
Showing
27 changed files
with
257 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
CMP0068 | ||
------- | ||
|
||
``RPATH`` settings on macOS do not affect ``install_name``. | ||
|
||
CMake 3.9 and newer remove any effect the following settings may have on the | ||
``install_name`` of a target on macOS: | ||
|
||
* :prop_tgt:`BUILD_WITH_INSTALL_RPATH` target property | ||
* :prop_tgt:`SKIP_BUILD_RPATH` target property | ||
* :variable:`CMAKE_SKIP_RPATH` variable | ||
* :variable:`CMAKE_SKIP_INSTALL_RPATH` variable | ||
|
||
Previously, setting :prop_tgt:`BUILD_WITH_INSTALL_RPATH` had the effect of | ||
setting both the ``install_name`` of a target to :prop_tgt:`INSTALL_NAME_DIR` | ||
and the ``RPATH`` to :prop_tgt:`INSTALL_RPATH`. In CMake 3.9, it only affects | ||
setting of ``RPATH``. However, if one wants :prop_tgt:`INSTALL_NAME_DIR` to | ||
apply to the target in the build tree, one may set | ||
:prop_tgt:`BUILD_WITH_INSTALL_NAME_DIR`. | ||
|
||
If :prop_tgt:`SKIP_BUILD_RPATH`, :variable:`CMAKE_SKIP_RPATH` or | ||
:variable:`CMAKE_SKIP_INSTALL_RPATH` were used to strip the directory portion | ||
of the ``install_name`` of a target, one may set ``INSTALL_NAME_DIR=""`` | ||
instead. | ||
|
||
The ``OLD`` behavior of this policy is to use the ``RPATH`` settings for | ||
``install_name`` on macOS. The ``NEW`` behavior of this policy is to ignore | ||
the ``RPATH`` settings for ``install_name`` on macOS. | ||
|
||
This policy was introduced in CMake version 3.9. 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
BUILD_WITH_INSTALL_NAME_DIR | ||
--------------------------- | ||
|
||
``BUILD_WITH_INSTALL_NAME_DIR`` is a boolean specifying whether the macOS | ||
``install_name`` of a target in the build tree uses the directory given by | ||
:prop_tgt:`INSTALL_NAME_DIR`. This setting only applies to targets on macOS. | ||
|
||
This property is initialized by the value of the variable | ||
:variable:`CMAKE_BUILD_WITH_INSTALL_NAME_DIR` if it is set when a target is | ||
created. | ||
|
||
If this property is not set and policy :policy:`CMP0068` is not ``NEW``, the | ||
value of :prop_tgt:`BUILD_WITH_INSTALL_RPATH` is used in its place. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
BUILD_WITH_INSTALL_RPATH | ||
------------------------ | ||
|
||
Should build tree targets have install tree rpaths. | ||
``BUILD_WITH_INSTALL_RPATH`` is a boolean specifying whether to link the target | ||
in the build tree with the :prop_tgt:`INSTALL_RPATH`. This takes precedence | ||
over :prop_tgt:`SKIP_BUILD_RPATH` and avoids the need for relinking before | ||
installation. | ||
|
||
BUILD_WITH_INSTALL_RPATH is a boolean specifying whether to link the | ||
target in the build tree with the INSTALL_RPATH. This takes | ||
precedence over SKIP_BUILD_RPATH and avoids the need for relinking | ||
before installation. This property is initialized by the value of the | ||
variable CMAKE_BUILD_WITH_INSTALL_RPATH if it is set when a target is | ||
created. | ||
This property is initialized by the value of the | ||
:variable:`CMAKE_BUILD_WITH_INSTALL_RPATH` variable if it is set when a target | ||
is created. | ||
|
||
If policy :policy:`CMP0068` is not ``NEW``, this property also controls use of | ||
:prop_tgt:`INSTALL_NAME_DIR` in the build tree on macOS. Either way, the | ||
:prop_tgt:`BUILD_WITH_INSTALL_NAME_DIR` target property takes precedence. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
install_name_policy | ||
------------------- | ||
|
||
* A :prop_tgt:`BUILD_WITH_INSTALL_NAME_DIR` target property and corresponding | ||
:variable:`CMAKE_BUILD_WITH_INSTALL_NAME_DIR` variable were added to | ||
control whether to use the :prop_tgt:`INSTALL_NAME_DIR` target property | ||
value for binaries in the build tree. This is for macOS ``install_name`` | ||
as :prop_tgt:`BUILD_WITH_INSTALL_RPATH` is for ``RPATH``. | ||
|
||
* On macOS, ``RPATH`` settings such as :prop_tgt:`BUILD_WITH_INSTALL_RPATH` | ||
no longer affect the ``install_name`` field. See policy :policy:`CMP0068`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CMAKE_BUILD_WITH_INSTALL_NAME_DIR | ||
--------------------------------- | ||
|
||
Whether to use :prop_tgt:`INSTALL_NAME_DIR` on targets in the build tree. | ||
|
||
This variable is used to initialize the :prop_tgt:`BUILD_WITH_INSTALL_NAME_DIR` | ||
property on all targets. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
cmake_policy(SET CMP0068 NEW) | ||
cmake_policy(SET CMP0042 NEW) | ||
|
||
add_library(foo SHARED empty.cpp) | ||
set_target_properties(foo PROPERTIES INSTALL_NAME_DIR "@rpath" INSTALL_RPATH "@loader_path/" BUILD_WITH_INSTALL_RPATH 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
cmake_policy(SET CMP0068 OLD) | ||
cmake_policy(SET CMP0042 NEW) | ||
|
||
add_library(foo SHARED empty.cpp) | ||
set_target_properties(foo PROPERTIES INSTALL_NAME_DIR "@rpath" INSTALL_RPATH "@loader_path/" BUILD_WITH_INSTALL_RPATH 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CMake Warning \(dev\): | ||
Policy CMP0068 is not set: RPATH settings on macOS do not affect | ||
install_name. Run "cmake --help-policy CMP0068" for policy details. Use | ||
the cmake_policy command to set the policy and suppress this warning. | ||
|
||
For compatibility with older versions of CMake, the install_name fields for | ||
the following targets are still affected by RPATH settings: | ||
|
||
foo3 | ||
foo4 | ||
|
||
This warning is for project developers. Use -Wno-dev to suppress it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
cmake_policy(SET CMP0042 NEW) | ||
|
||
add_library(foo SHARED empty.cpp) | ||
add_library(foo-static STATIC empty.cpp) | ||
add_library(foo2 SHARED empty.cpp) | ||
set_target_properties(foo2 PROPERTIES MACOSX_RPATH 1) | ||
add_library(foo3 SHARED empty.cpp) | ||
set_target_properties(foo3 PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@loader_path") | ||
add_library(foo4 SHARED empty.cpp) | ||
set_target_properties(foo4 PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@rpath") | ||
add_library(foo5 SHARED empty.cpp) | ||
set_target_properties(foo5 PROPERTIES BUILD_WITH_INSTALL_RPATH 1 BUILD_WITH_INSTALL_NAME_DIR 1 INSTALL_NAME_DIR "@rpath") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(${RunCMake_TEST} CXX) | ||
include(${RunCMake_TEST}.cmake) |
Oops, something went wrong.