Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CMake
CMake
Commits
d560bfd2
Commit
d560bfd2
authored
Aug 04, 2015
by
Stephen Kelly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmGeneratorTarget: Move GetInstallNameDir* from cmTarget.
parent
89e2a080
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
100 additions
and
94 deletions
+100
-94
Source/cmExportBuildFileGenerator.cxx
Source/cmExportBuildFileGenerator.cxx
+2
-2
Source/cmExportBuildFileGenerator.h
Source/cmExportBuildFileGenerator.h
+2
-1
Source/cmExportFileGenerator.cxx
Source/cmExportFileGenerator.cxx
+1
-1
Source/cmExportFileGenerator.h
Source/cmExportFileGenerator.h
+1
-1
Source/cmExportInstallFileGenerator.cxx
Source/cmExportInstallFileGenerator.cxx
+2
-2
Source/cmExportInstallFileGenerator.h
Source/cmExportInstallFileGenerator.h
+2
-1
Source/cmExportTryCompileFileGenerator.cxx
Source/cmExportTryCompileFileGenerator.cxx
+2
-2
Source/cmExportTryCompileFileGenerator.h
Source/cmExportTryCompileFileGenerator.h
+1
-1
Source/cmGeneratorTarget.cxx
Source/cmGeneratorTarget.cxx
+67
-0
Source/cmGeneratorTarget.h
Source/cmGeneratorTarget.h
+9
-0
Source/cmGlobalXCodeGenerator.cxx
Source/cmGlobalXCodeGenerator.cxx
+1
-1
Source/cmInstallTargetGenerator.cxx
Source/cmInstallTargetGenerator.cxx
+7
-4
Source/cmMakefileLibraryTargetGenerator.cxx
Source/cmMakefileLibraryTargetGenerator.cxx
+1
-1
Source/cmNinjaNormalTargetGenerator.cxx
Source/cmNinjaNormalTargetGenerator.cxx
+2
-1
Source/cmTarget.cxx
Source/cmTarget.cxx
+0
-67
Source/cmTarget.h
Source/cmTarget.h
+0
-9
No files found.
Source/cmExportBuildFileGenerator.cxx
View file @
d560bfd2
...
...
@@ -333,12 +333,12 @@ cmExportBuildFileGenerator
}
std
::
string
cmExportBuildFileGenerator
::
InstallNameDir
(
cmTarget
*
target
,
cmExportBuildFileGenerator
::
InstallNameDir
(
cm
Generator
Target
*
target
,
const
std
::
string
&
config
)
{
std
::
string
install_name_dir
;
cmMakefile
*
mf
=
target
->
GetMakefile
();
cmMakefile
*
mf
=
target
->
Target
->
GetMakefile
();
if
(
mf
->
IsOn
(
"CMAKE_PLATFORM_HAS_INSTALLNAME"
))
{
install_name_dir
=
...
...
Source/cmExportBuildFileGenerator.h
View file @
d560bfd2
...
...
@@ -71,7 +71,8 @@ protected:
cmGeneratorTarget
*
target
,
ImportPropertyMap
&
properties
);
std
::
string
InstallNameDir
(
cmTarget
*
target
,
const
std
::
string
&
config
);
std
::
string
InstallNameDir
(
cmGeneratorTarget
*
target
,
const
std
::
string
&
config
);
std
::
vector
<
std
::
string
>
FindNamespaces
(
cmMakefile
*
mf
,
const
std
::
string
&
name
);
...
...
Source/cmExportFileGenerator.cxx
View file @
d560bfd2
...
...
@@ -893,7 +893,7 @@ cmExportFileGenerator
{
if
(
mf
->
IsOn
(
"CMAKE_PLATFORM_HAS_INSTALLNAME"
))
{
value
=
this
->
InstallNameDir
(
target
->
Target
,
config
);
value
=
this
->
InstallNameDir
(
target
,
config
);
}
prop
=
"IMPORTED_SONAME"
;
value
+=
target
->
GetSOName
(
config
);
...
...
Source/cmExportFileGenerator.h
View file @
d560bfd2
...
...
@@ -200,7 +200,7 @@ private:
virtual
void
ReplaceInstallPrefix
(
std
::
string
&
input
);
virtual
std
::
string
InstallNameDir
(
cmTarget
*
target
,
virtual
std
::
string
InstallNameDir
(
cm
Generator
Target
*
target
,
const
std
::
string
&
config
)
=
0
;
};
...
...
Source/cmExportInstallFileGenerator.cxx
View file @
d560bfd2
...
...
@@ -546,12 +546,12 @@ cmExportInstallFileGenerator
}
std
::
string
cmExportInstallFileGenerator
::
InstallNameDir
(
cmTarget
*
target
,
cmExportInstallFileGenerator
::
InstallNameDir
(
cm
Generator
Target
*
target
,
const
std
::
string
&
)
{
std
::
string
install_name_dir
;
cmMakefile
*
mf
=
target
->
GetMakefile
();
cmMakefile
*
mf
=
target
->
Target
->
GetMakefile
();
if
(
mf
->
IsOn
(
"CMAKE_PLATFORM_HAS_INSTALLNAME"
))
{
install_name_dir
=
...
...
Source/cmExportInstallFileGenerator.h
View file @
d560bfd2
...
...
@@ -83,7 +83,8 @@ protected:
std
::
set
<
std
::
string
>&
importedLocations
);
std
::
string
InstallNameDir
(
cmTarget
*
target
,
const
std
::
string
&
config
);
std
::
string
InstallNameDir
(
cmGeneratorTarget
*
target
,
const
std
::
string
&
config
);
cmInstallExportGenerator
*
IEGen
;
...
...
Source/cmExportTryCompileFileGenerator.cxx
View file @
d560bfd2
...
...
@@ -125,12 +125,12 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target,
}
std
::
string
cmExportTryCompileFileGenerator
::
InstallNameDir
(
cmTarget
*
target
,
cmExportTryCompileFileGenerator
::
InstallNameDir
(
cm
Generator
Target
*
target
,
const
std
::
string
&
config
)
{
std
::
string
install_name_dir
;
cmMakefile
*
mf
=
target
->
GetMakefile
();
cmMakefile
*
mf
=
target
->
Target
->
GetMakefile
();
if
(
mf
->
IsOn
(
"CMAKE_PLATFORM_HAS_INSTALLNAME"
))
{
install_name_dir
=
...
...
Source/cmExportTryCompileFileGenerator.h
View file @
d560bfd2
...
...
@@ -45,7 +45,7 @@ protected:
ImportPropertyMap
&
properties
,
std
::
set
<
cmTarget
const
*>
&
emitted
);
std
::
string
InstallNameDir
(
cmTarget
*
target
,
std
::
string
InstallNameDir
(
cm
Generator
Target
*
target
,
const
std
::
string
&
config
);
private:
std
::
string
FindTargets
(
const
std
::
string
&
prop
,
cmTarget
const
*
tgt
,
...
...
Source/cmGeneratorTarget.cxx
View file @
d560bfd2
...
...
@@ -890,6 +890,73 @@ std::string cmGeneratorTarget::GetSOName(const std::string& config) const
}
}
//----------------------------------------------------------------------------
std
::
string
cmGeneratorTarget
::
GetInstallNameDirForBuildTree
(
const
std
::
string
&
config
)
const
{
// If building directly for installation then the build tree install_name
// is the same as the install tree.
if
(
this
->
GetPropertyAsBool
(
"BUILD_WITH_INSTALL_RPATH"
))
{
return
this
->
GetInstallNameDirForInstallTree
();
}
// Use the build tree directory for the target.
if
(
this
->
Makefile
->
IsOn
(
"CMAKE_PLATFORM_HAS_INSTALLNAME"
)
&&
!
this
->
Makefile
->
IsOn
(
"CMAKE_SKIP_RPATH"
)
&&
!
this
->
GetPropertyAsBool
(
"SKIP_BUILD_RPATH"
))
{
std
::
string
dir
;
if
(
this
->
Target
->
MacOSXRpathInstallNameDirDefault
())
{
dir
=
"@rpath"
;
}
else
{
dir
=
this
->
Target
->
GetDirectory
(
config
);
}
dir
+=
"/"
;
return
dir
;
}
else
{
return
""
;
}
}
//----------------------------------------------------------------------------
std
::
string
cmGeneratorTarget
::
GetInstallNameDirForInstallTree
()
const
{
if
(
this
->
Makefile
->
IsOn
(
"CMAKE_PLATFORM_HAS_INSTALLNAME"
))
{
std
::
string
dir
;
const
char
*
install_name_dir
=
this
->
GetProperty
(
"INSTALL_NAME_DIR"
);
if
(
!
this
->
Makefile
->
IsOn
(
"CMAKE_SKIP_RPATH"
)
&&
!
this
->
Makefile
->
IsOn
(
"CMAKE_SKIP_INSTALL_RPATH"
))
{
if
(
install_name_dir
&&
*
install_name_dir
)
{
dir
=
install_name_dir
;
dir
+=
"/"
;
}
}
if
(
!
install_name_dir
)
{
if
(
this
->
Target
->
MacOSXRpathInstallNameDirDefault
())
{
dir
=
"@rpath/"
;
}
}
return
dir
;
}
else
{
return
""
;
}
}
//----------------------------------------------------------------------------
void
cmGeneratorTarget
::
GetFullNameComponents
(
std
::
string
&
prefix
,
std
::
string
&
base
,
...
...
Source/cmGeneratorTarget.h
View file @
d560bfd2
...
...
@@ -115,6 +115,15 @@ public:
bool
realname
)
const
;
std
::
string
NormalGetRealName
(
const
std
::
string
&
config
)
const
;
/** Return the install name directory for the target in the
* build tree. For example: "\@rpath/", "\@loader_path/",
* or "/full/path/to/library". */
std
::
string
GetInstallNameDirForBuildTree
(
const
std
::
string
&
config
)
const
;
/** Return the install name directory for the target in the
* install tree. For example: "\@rpath/" or "\@loader_path/". */
std
::
string
GetInstallNameDirForInstallTree
()
const
;
/** Get the soname of the target. Allowed only for a shared library. */
std
::
string
GetSOName
(
const
std
::
string
&
config
)
const
;
...
...
Source/cmGlobalXCodeGenerator.cxx
View file @
d560bfd2
...
...
@@ -2331,7 +2331,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
if
(
target
.
GetType
()
==
cmTarget
::
SHARED_LIBRARY
)
{
// Get the install_name directory for the build tree.
install_name_dir
=
target
.
GetInstallNameDirForBuildTree
(
configName
);
install_name_dir
=
gtgt
->
GetInstallNameDirForBuildTree
(
configName
);
// Xcode doesn't create the correct install_name in some cases.
// That is, if the INSTALL_PATH is empty, or if we have versioning
// of dylib libraries, we want to specify the install_name.
...
...
Source/cmInstallTargetGenerator.cxx
View file @
d560bfd2
...
...
@@ -576,11 +576,14 @@ cmInstallTargetGenerator
continue
;
}
cmGeneratorTarget
*
gtgt
=
tgt
->
GetMakefile
()
->
GetGlobalGenerator
()
->
GetGeneratorTarget
(
tgt
);
// If the build tree and install tree use different path
// components of the install_name field then we need to create a
// mapping to be applied after installation.
std
::
string
for_build
=
tgt
->
GetInstallNameDirForBuildTree
(
config
);
std
::
string
for_install
=
tgt
->
GetInstallNameDirForInstallTree
();
std
::
string
for_build
=
g
tgt
->
GetInstallNameDirForBuildTree
(
config
);
std
::
string
for_install
=
g
tgt
->
GetInstallNameDirForInstallTree
();
if
(
for_build
!=
for_install
)
{
// The directory portions differ. Append the filename to
...
...
@@ -605,9 +608,9 @@ cmInstallTargetGenerator
if
(
this
->
Target
->
GetType
()
==
cmTarget
::
SHARED_LIBRARY
)
{
std
::
string
for_build
=
this
->
Target
->
Target
->
GetInstallNameDirForBuildTree
(
config
);
this
->
Target
->
GetInstallNameDirForBuildTree
(
config
);
std
::
string
for_install
=
this
->
Target
->
Target
->
GetInstallNameDirForInstallTree
();
this
->
Target
->
GetInstallNameDirForInstallTree
();
if
(
this
->
Target
->
Target
->
IsFrameworkOnApple
()
&&
for_install
.
empty
())
{
...
...
Source/cmMakefileLibraryTargetGenerator.cxx
View file @
d560bfd2
...
...
@@ -666,7 +666,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
{
// Get the install_name directory for the build tree.
install_name_dir
=
this
->
Target
->
GetInstallNameDirForBuildTree
(
this
->
ConfigName
);
this
->
Generator
Target
->
GetInstallNameDirForBuildTree
(
this
->
ConfigName
);
// Set the rule variable replacement value.
if
(
install_name_dir
.
empty
())
...
...
Source/cmNinjaNormalTargetGenerator.cxx
View file @
d560bfd2
...
...
@@ -537,7 +537,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars
[
"SONAME"
]
=
this
->
TargetNameSO
;
if
(
targetType
==
cmTarget
::
SHARED_LIBRARY
)
{
std
::
string
install_dir
=
target
.
GetInstallNameDirForBuildTree
(
cfgName
);
std
::
string
install_dir
=
this
->
GetGeneratorTarget
()
->
GetInstallNameDirForBuildTree
(
cfgName
);
if
(
!
install_dir
.
empty
())
{
vars
[
"INSTALLNAME_DIR"
]
=
localGen
.
Convert
(
install_dir
,
...
...
Source/cmTarget.cxx
View file @
d560bfd2
...
...
@@ -3845,73 +3845,6 @@ bool cmTarget::HaveInstallTreeRPATH() const
!
this
->
Makefile
->
IsOn
(
"CMAKE_SKIP_INSTALL_RPATH"
);
}
//----------------------------------------------------------------------------
std
::
string
cmTarget
::
GetInstallNameDirForBuildTree
(
const
std
::
string
&
config
)
const
{
// If building directly for installation then the build tree install_name
// is the same as the install tree.
if
(
this
->
GetPropertyAsBool
(
"BUILD_WITH_INSTALL_RPATH"
))
{
return
GetInstallNameDirForInstallTree
();
}
// Use the build tree directory for the target.
if
(
this
->
Makefile
->
IsOn
(
"CMAKE_PLATFORM_HAS_INSTALLNAME"
)
&&
!
this
->
Makefile
->
IsOn
(
"CMAKE_SKIP_RPATH"
)
&&
!
this
->
GetPropertyAsBool
(
"SKIP_BUILD_RPATH"
))
{
std
::
string
dir
;
bool
macosx_rpath
=
this
->
MacOSXRpathInstallNameDirDefault
();
if
(
macosx_rpath
)
{
dir
=
"@rpath"
;
}
else
{
dir
=
this
->
GetDirectory
(
config
);
}
dir
+=
"/"
;
return
dir
;
}
else
{
return
""
;
}
}
//----------------------------------------------------------------------------
std
::
string
cmTarget
::
GetInstallNameDirForInstallTree
()
const
{
if
(
this
->
Makefile
->
IsOn
(
"CMAKE_PLATFORM_HAS_INSTALLNAME"
))
{
std
::
string
dir
;
const
char
*
install_name_dir
=
this
->
GetProperty
(
"INSTALL_NAME_DIR"
);
if
(
!
this
->
Makefile
->
IsOn
(
"CMAKE_SKIP_RPATH"
)
&&
!
this
->
Makefile
->
IsOn
(
"CMAKE_SKIP_INSTALL_RPATH"
))
{
if
(
install_name_dir
&&
*
install_name_dir
)
{
dir
=
install_name_dir
;
dir
+=
"/"
;
}
}
if
(
!
install_name_dir
)
{
if
(
this
->
MacOSXRpathInstallNameDirDefault
())
{
dir
=
"@rpath/"
;
}
}
return
dir
;
}
else
{
return
""
;
}
}
//----------------------------------------------------------------------------
const
char
*
cmTarget
::
GetOutputTargetType
(
bool
implib
)
const
{
...
...
Source/cmTarget.h
View file @
d560bfd2
...
...
@@ -394,15 +394,6 @@ public:
bool
HaveBuildTreeRPATH
(
const
std
::
string
&
config
)
const
;
bool
HaveInstallTreeRPATH
()
const
;
/** Return the install name directory for the target in the
* build tree. For example: "\@rpath/", "\@loader_path/",
* or "/full/path/to/library". */
std
::
string
GetInstallNameDirForBuildTree
(
const
std
::
string
&
config
)
const
;
/** Return the install name directory for the target in the
* install tree. For example: "\@rpath/" or "\@loader_path/". */
std
::
string
GetInstallNameDirForInstallTree
()
const
;
// Get the properties
cmPropertyMap
&
GetProperties
()
const
{
return
this
->
Properties
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment