Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stephen Kelly
CMake
Commits
41340304
Commit
41340304
authored
Oct 08, 2016
by
Stephen Kelly
Browse files
cmLinkLineComputer: Extract link libraries computation from cmLocalGenerator
Hide some methods which no longer need to be public.
parent
f03d446e
Pipeline
#30065
passed with stage
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Source/cmLinkLineComputer.cxx
View file @
41340304
...
...
@@ -152,3 +152,28 @@ std::string cmLinkLineComputer::ComputeFrameworkPath(
}
return
frameworkPath
;
}
std
::
string
cmLinkLineComputer
::
ComputeLinkLibraries
(
cmComputeLinkInformation
&
cli
,
std
::
string
const
&
stdLibString
)
{
std
::
ostringstream
fout
;
fout
<<
this
->
ComputeRPath
(
cli
);
// Write the library flags to the build rule.
fout
<<
this
->
ComputeLinkLibs
(
cli
);
// Add the linker runtime search path if any.
std
::
string
rpath_link
=
cli
.
GetRPathLinkString
();
if
(
!
cli
.
GetRPathLinkFlag
().
empty
()
&&
!
rpath_link
.
empty
())
{
fout
<<
cli
.
GetRPathLinkFlag
();
fout
<<
this
->
OutputConverter
->
EscapeForShell
(
rpath_link
,
!
this
->
ForResponse
);
fout
<<
" "
;
}
if
(
!
stdLibString
.
empty
())
{
fout
<<
stdLibString
<<
" "
;
}
return
fout
.
str
();
}
Source/cmLinkLineComputer.h
View file @
41340304
...
...
@@ -22,18 +22,20 @@ public:
virtual
std
::
string
ConvertToLinkReference
(
std
::
string
const
&
input
)
const
;
std
::
string
ComputeLinkLibs
(
cmComputeLinkInformation
&
cli
);
std
::
string
ComputeLinkPath
(
cmComputeLinkInformation
&
cli
,
std
::
string
const
&
libPathFlag
,
std
::
string
const
&
libPathTerminator
);
std
::
string
ComputeRPath
(
cmComputeLinkInformation
&
cli
);
std
::
string
ComputeFrameworkPath
(
cmComputeLinkInformation
&
cli
,
std
::
string
const
&
fwSearchFlag
);
std
::
string
ComputeLinkLibraries
(
cmComputeLinkInformation
&
cli
,
std
::
string
const
&
stdLibString
);
private:
std
::
string
ComputeLinkLibs
(
cmComputeLinkInformation
&
cli
);
std
::
string
ComputeRPath
(
cmComputeLinkInformation
&
cli
);
std
::
string
ConvertToOutputFormat
(
std
::
string
const
&
input
);
std
::
string
ConvertToOutputForExisting
(
std
::
string
const
&
input
);
...
...
Source/cmLocalGenerator.cxx
View file @
41340304
...
...
@@ -1207,7 +1207,7 @@ void cmLocalGenerator::GetTargetFlags(
}
if
(
pcli
)
{
this
->
OutputLinkLibraries
(
pcli
,
linkLineComputer
,
linkLibs
,
frameworkPath
,
linkPath
,
false
);
frameworkPath
,
linkPath
);
}
}
break
;
case
cmState
::
EXECUTABLE
:
{
...
...
@@ -1229,7 +1229,7 @@ void cmLocalGenerator::GetTargetFlags(
this
->
AddLanguageFlags
(
flags
,
linkLanguage
,
buildType
);
if
(
pcli
)
{
this
->
OutputLinkLibraries
(
pcli
,
linkLineComputer
,
linkLibs
,
frameworkPath
,
linkPath
,
false
);
frameworkPath
,
linkPath
);
}
if
(
cmSystemTools
::
IsOn
(
this
->
Makefile
->
GetDefinition
(
"BUILD_SHARED_LIBS"
)))
{
...
...
@@ -1397,7 +1397,7 @@ std::string cmLocalGenerator::GetTargetFortranFlags(
void
cmLocalGenerator
::
OutputLinkLibraries
(
cmComputeLinkInformation
*
pcli
,
cmLinkLineComputer
*
linkLineComputer
,
std
::
string
&
linkLibraries
,
std
::
string
&
frameworkPath
,
std
::
string
&
linkPath
,
bool
forResponseFile
)
std
::
string
&
linkPath
)
{
cmComputeLinkInformation
&
cli
=
*
pcli
;
...
...
@@ -1428,29 +1428,7 @@ void cmLocalGenerator::OutputLinkLibraries(
linkPath
=
linkLineComputer
->
ComputeLinkPath
(
cli
,
libPathFlag
,
libPathTerminator
);
std
::
string
linkLibs
=
linkLineComputer
->
ComputeLinkLibs
(
cli
);
std
::
string
rpath
=
linkLineComputer
->
ComputeRPath
(
cli
);
std
::
ostringstream
fout
;
fout
<<
rpath
;
// Write the library flags to the build rule.
fout
<<
linkLibs
;
// Add the linker runtime search path if any.
std
::
string
rpath_link
=
cli
.
GetRPathLinkString
();
if
(
!
cli
.
GetRPathLinkFlag
().
empty
()
&&
!
rpath_link
.
empty
())
{
fout
<<
cli
.
GetRPathLinkFlag
();
fout
<<
this
->
EscapeForShell
(
rpath_link
,
!
forResponseFile
);
fout
<<
" "
;
}
if
(
!
stdLibString
.
empty
())
{
fout
<<
stdLibString
<<
" "
;
}
linkLibraries
=
fout
.
str
();
linkLibraries
=
linkLineComputer
->
ComputeLinkLibraries
(
cli
,
stdLibString
);
}
std
::
string
cmLocalGenerator
::
GetLinkLibsCMP0065
(
...
...
Source/cmLocalGenerator.h
View file @
41340304
...
...
@@ -351,8 +351,7 @@ protected:
void
OutputLinkLibraries
(
cmComputeLinkInformation
*
pcli
,
cmLinkLineComputer
*
linkLineComputer
,
std
::
string
&
linkLibraries
,
std
::
string
&
frameworkPath
,
std
::
string
&
linkPath
,
bool
forResponseFile
);
std
::
string
&
frameworkPath
,
std
::
string
&
linkPath
);
// Expand rule variables in CMake of the type found in language rules
void
ExpandRuleVariables
(
std
::
string
&
string
,
...
...
Source/cmMakefileTargetGenerator.cxx
View file @
41340304
...
...
@@ -1610,8 +1610,7 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
cmComputeLinkInformation
*
pcli
=
this
->
GeneratorTarget
->
GetLinkInformation
(
config
);
this
->
LocalGenerator
->
OutputLinkLibraries
(
pcli
,
linkLineComputer
,
linkLibs
,
frameworkPath
,
linkPath
,
useResponseFile
);
frameworkPath
,
linkPath
);
linkLibs
=
frameworkPath
+
linkPath
+
linkLibs
;
if
(
useResponseFile
&&
linkLibs
.
find_first_not_of
(
' '
)
!=
linkLibs
.
npos
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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