Add an option to skip RPATH during installation.
This commit is contained in:
parent
e316cbbbc3
commit
635bf50c27
|
@ -39,6 +39,8 @@ SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
|
||||||
|
|
||||||
SET (CMAKE_SKIP_RPATH "NO" CACHE BOOL
|
SET (CMAKE_SKIP_RPATH "NO" CACHE BOOL
|
||||||
"If set, runtime paths are not added when using shared libraries.")
|
"If set, runtime paths are not added when using shared libraries.")
|
||||||
|
SET (CMAKE_SKIP_INSTALL_RPATH "NO" CACHE BOOL
|
||||||
|
"If set, runtime paths are not added when installing shared libraries, but are added when building.")
|
||||||
|
|
||||||
SET(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.")
|
SET(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.")
|
||||||
|
|
||||||
|
@ -168,5 +170,6 @@ ENDIF(CMAKE_HOST_UNIX)
|
||||||
|
|
||||||
MARK_AS_ADVANCED(
|
MARK_AS_ADVANCED(
|
||||||
CMAKE_SKIP_RPATH
|
CMAKE_SKIP_RPATH
|
||||||
|
CMAKE_SKIP_INSTALL_RPATH
|
||||||
CMAKE_VERBOSE_MAKEFILE
|
CMAKE_VERBOSE_MAKEFILE
|
||||||
)
|
)
|
||||||
|
|
|
@ -1760,6 +1760,7 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
|
||||||
!linking_for_install);
|
!linking_for_install);
|
||||||
bool use_link_rpath =
|
bool use_link_rpath =
|
||||||
outputRuntime && linking_for_install &&
|
outputRuntime && linking_for_install &&
|
||||||
|
!this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH") &&
|
||||||
this->Target->GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH");
|
this->Target->GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH");
|
||||||
|
|
||||||
// Construct the RPATH.
|
// Construct the RPATH.
|
||||||
|
|
|
@ -355,7 +355,9 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
|
||||||
"If this is set to TRUE, then the rpath information "
|
"If this is set to TRUE, then the rpath information "
|
||||||
"is not added to compiled executables. The default "
|
"is not added to compiled executables. The default "
|
||||||
"is to add rpath information if the platform supports it. "
|
"is to add rpath information if the platform supports it. "
|
||||||
"This allows for easy running from the build tree.",false,
|
"This allows for easy running from the build tree. To omit RPATH"
|
||||||
|
"in the install step, but not the build step, use "
|
||||||
|
"CMAKE_SKIP_INSTALL_RPATH instead.",false,
|
||||||
"Variables that Provide Information");
|
"Variables that Provide Information");
|
||||||
cm->DefineProperty
|
cm->DefineProperty
|
||||||
("CMAKE_SOURCE_DIR", cmProperty::VARIABLE,
|
("CMAKE_SOURCE_DIR", cmProperty::VARIABLE,
|
||||||
|
@ -1180,6 +1182,20 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
|
||||||
"is always built with no RPATH.",false,
|
"is always built with no RPATH.",false,
|
||||||
"Variables that Control the Build");
|
"Variables that Control the Build");
|
||||||
|
|
||||||
|
cm->DefineProperty
|
||||||
|
("CMAKE_SKIP_INSTALL_RPATH", cmProperty::VARIABLE,
|
||||||
|
"Do not include RPATHs in the install tree.",
|
||||||
|
"Normally CMake uses the build tree for the RPATH when building "
|
||||||
|
"executables etc on systems that use RPATH. When the software "
|
||||||
|
"is installed the executables etc are relinked by CMake to have "
|
||||||
|
"the install RPATH. If this variable is set to true then the software "
|
||||||
|
"is always installed without RPATH, even if RPATH is enabled when "
|
||||||
|
"building. This can be useful for example to allow running tests from "
|
||||||
|
"the build directory with RPATH enabled before the installation step. "
|
||||||
|
"To omit RPATH in both the build and install steps, use "
|
||||||
|
"CMAKE_SKIP_RPATH instead.",false,
|
||||||
|
"Variables that Control the Build");
|
||||||
|
|
||||||
cm->DefineProperty
|
cm->DefineProperty
|
||||||
("CMAKE_EXE_LINKER_FLAGS", cmProperty::VARIABLE,
|
("CMAKE_EXE_LINKER_FLAGS", cmProperty::VARIABLE,
|
||||||
"Linker flags used to create executables.",
|
"Linker flags used to create executables.",
|
||||||
|
|
|
@ -3602,7 +3602,8 @@ bool cmTarget::HaveBuildTreeRPATH()
|
||||||
bool cmTarget::HaveInstallTreeRPATH()
|
bool cmTarget::HaveInstallTreeRPATH()
|
||||||
{
|
{
|
||||||
const char* install_rpath = this->GetProperty("INSTALL_RPATH");
|
const char* install_rpath = this->GetProperty("INSTALL_RPATH");
|
||||||
return install_rpath && *install_rpath;
|
return (install_rpath && *install_rpath) &&
|
||||||
|
!this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH");
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -3709,7 +3710,8 @@ std::string cmTarget::GetInstallNameDirForInstallTree(const char* config,
|
||||||
{
|
{
|
||||||
std::string dir;
|
std::string dir;
|
||||||
|
|
||||||
if(!this->Makefile->IsOn("CMAKE_SKIP_RPATH"))
|
if(!this->Makefile->IsOn("CMAKE_SKIP_RPATH") &&
|
||||||
|
!this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH"))
|
||||||
{
|
{
|
||||||
const char* install_name_dir = this->GetProperty("INSTALL_NAME_DIR");
|
const char* install_name_dir = this->GetProperty("INSTALL_NAME_DIR");
|
||||||
if(install_name_dir && *install_name_dir)
|
if(install_name_dir && *install_name_dir)
|
||||||
|
|
Loading…
Reference in New Issue