Commit f7b9bf41 authored by Clinton Stimpson's avatar Clinton Stimpson
Browse files

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.
parent 4bff2d14
......@@ -123,6 +123,7 @@ Properties on Targets
......@@ -263,6 +263,7 @@ Variables that Control the Build
``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
If this property is not set, the value of :prop_tgt:`BUILD_WITH_INSTALL_RPATH`
is used in its place.
......@@ -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.
* 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``.
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.
......@@ -1396,6 +1396,12 @@ bool cmGeneratorTarget::MacOSXRpathInstallNameDirDefault() const
bool cmGeneratorTarget::MacOSXUseInstallNameDir() const
const char* build_with_install_name =
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;
......@@ -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("C_CLANG_TIDY", CM_NULLPTR);
this->SetPropertyDefault("C_COMPILER_LAUNCHER", CM_NULLPTR);
this->SetPropertyDefault("C_CPPLINT", CM_NULLPTR);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment