Apple: Add BUILD_WITH_INSTALL_NAME_DIR target property

This new property controls whether to apply INSTALL_NAME_DIR to the
build tree.  It also overrides BUILD_WITH_INSTALL_RPATH.
This commit is contained in:
Clinton Stimpson 2017-02-09 08:05:10 -07:00
parent 4bff2d14fd
commit f7b9bf41c5
8 changed files with 41 additions and 0 deletions

View File

@ -123,6 +123,7 @@ Properties on Targets
/prop_tgt/AUTORCC_OPTIONS
/prop_tgt/BINARY_DIR
/prop_tgt/BUILD_RPATH
/prop_tgt/BUILD_WITH_INSTALL_NAME_DIR
/prop_tgt/BUILD_WITH_INSTALL_RPATH
/prop_tgt/BUNDLE_EXTENSION
/prop_tgt/BUNDLE

View File

@ -263,6 +263,7 @@ Variables that Control the Build
/variable/CMAKE_AUTOUIC
/variable/CMAKE_AUTOUIC_OPTIONS
/variable/CMAKE_BUILD_RPATH
/variable/CMAKE_BUILD_WITH_INSTALL_NAME_DIR
/variable/CMAKE_BUILD_WITH_INSTALL_RPATH
/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY
/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG

View File

@ -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, the value of :prop_tgt:`BUILD_WITH_INSTALL_RPATH`
is used in its place.

View File

@ -9,3 +9,7 @@ installation.
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.
This property also controls use of :prop_tgt:`INSTALL_NAME_DIR` in the build
tree on macOS, but defers to the :prop_tgt:`BUILD_WITH_INSTALL_NAME_DIR` target
property if the latter is set.

View File

@ -0,0 +1,8 @@
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``.

View File

@ -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.

View File

@ -1396,6 +1396,12 @@ bool cmGeneratorTarget::MacOSXRpathInstallNameDirDefault() const
bool cmGeneratorTarget::MacOSXUseInstallNameDir() const
{
const char* build_with_install_name =
this->GetProperty("BUILD_WITH_INSTALL_NAME_DIR");
if (build_with_install_name) {
return cmSystemTools::IsOn(build_with_install_name);
}
bool use_install_name = this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH");
return use_install_name;

View File

@ -253,6 +253,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->SetPropertyDefault("WIN32_EXECUTABLE", CM_NULLPTR);
this->SetPropertyDefault("MACOSX_BUNDLE", CM_NULLPTR);
this->SetPropertyDefault("MACOSX_RPATH", CM_NULLPTR);
this->SetPropertyDefault("BUILD_WITH_INSTALL_NAME_DIR", CM_NULLPTR);
this->SetPropertyDefault("C_CLANG_TIDY", CM_NULLPTR);
this->SetPropertyDefault("C_COMPILER_LAUNCHER", CM_NULLPTR);
this->SetPropertyDefault("C_CPPLINT", CM_NULLPTR);