Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Brad King
CMake
Commits
042c1c83
Commit
042c1c83
authored
Mar 18, 2014
by
Stephen Kelly
Browse files
cmTarget: Compute languages from object libraries on demand.
parent
fdcefe3c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Source/cmTarget.cxx
View file @
042c1c83
...
...
@@ -608,13 +608,6 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs)
if
(
src
[
0
]
==
'$'
&&
src
[
1
]
==
'<'
)
{
this
->
AddSource
(
src
);
if
(
cmHasLiteralPrefix
(
i
->
c_str
(),
"$<TARGET_OBJECTS:"
)
&&
(
*
i
)[
i
->
size
()
-
1
]
==
'>'
)
{
std
::
string
objLibName
=
i
->
substr
(
17
,
i
->
size
()
-
18
);
this
->
ObjectLibraries
.
push_back
(
objLibName
);
}
}
else
{
...
...
@@ -5013,6 +5006,53 @@ void cmTarget::GetLanguages(std::set<std::string>& languages) const
languages
.
insert
(
lang
);
}
}
std
::
vector
<
cmTarget
*>
objectLibraries
;
std
::
vector
<
cmSourceFile
const
*>
externalObjects
;
if
(
this
->
Makefile
->
GetGeneratorTargets
().
empty
())
{
// At configure-time, this method can be called as part of getting the
// LOCATION property or to export() a file to be include()d. However
// there is no cmGeneratorTarget at configure-time, so search the SOURCES
// for TARGET_OBJECTS instead for backwards compatibility with OLD
// behavior of CMP0024 and CMP0026 only.
std
::
vector
<
std
::
string
>
srcs
;
cmSystemTools
::
ExpandListArgument
(
this
->
GetProperty
(
"SOURCES"
),
srcs
);
for
(
std
::
vector
<
std
::
string
>::
const_iterator
it
=
srcs
.
begin
();
it
!=
srcs
.
end
();
++
it
)
{
if
(
cmHasLiteralPrefix
(
*
it
,
"$<TARGET_OBJECTS:"
)
&&
cmHasLiteralSuffix
(
*
it
,
">"
))
{
std
::
string
objLibName
=
it
->
substr
(
17
,
it
->
size
()
-
18
);
if
(
cmTarget
*
tgt
=
this
->
Makefile
->
FindTargetToUse
(
objLibName
))
{
objectLibraries
.
push_back
(
tgt
);
}
}
}
}
else
{
cmGeneratorTarget
*
gt
=
this
->
Makefile
->
GetLocalGenerator
()
->
GetGlobalGenerator
()
->
GetGeneratorTarget
(
this
);
gt
->
GetExternalObjects
(
externalObjects
);
for
(
std
::
vector
<
cmSourceFile
const
*>::
const_iterator
i
=
externalObjects
.
begin
();
i
!=
externalObjects
.
end
();
++
i
)
{
std
::
string
objLib
=
(
*
i
)
->
GetObjectLibrary
();
if
(
cmTarget
*
tgt
=
this
->
Makefile
->
FindTargetToUse
(
objLib
))
{
objectLibraries
.
push_back
(
tgt
);
}
}
}
for
(
std
::
vector
<
cmTarget
*>::
const_iterator
i
=
objectLibraries
.
begin
();
i
!=
objectLibraries
.
end
();
++
i
)
{
(
*
i
)
->
GetLanguages
(
languages
);
}
}
//----------------------------------------------------------------------------
...
...
@@ -6077,19 +6117,6 @@ cmTarget::ComputeLinkImplementationLanguages(LinkImplementation& impl) const
std
::
set
<
std
::
string
>
languages
;
// Get languages used in our source files.
this
->
GetLanguages
(
languages
);
// Get languages used in object library sources.
for
(
std
::
vector
<
std
::
string
>::
const_iterator
i
=
this
->
ObjectLibraries
.
begin
();
i
!=
this
->
ObjectLibraries
.
end
();
++
i
)
{
if
(
cmTarget
*
objLib
=
this
->
Makefile
->
FindTargetToUse
(
*
i
))
{
if
(
objLib
->
GetType
()
==
cmTarget
::
OBJECT_LIBRARY
)
{
objLib
->
GetLanguages
(
languages
);
}
}
}
// Copy the set of langauges to the link implementation.
for
(
std
::
set
<
std
::
string
>::
iterator
li
=
languages
.
begin
();
li
!=
languages
.
end
();
++
li
)
...
...
Source/cmTarget.h
View file @
042c1c83
...
...
@@ -137,10 +137,6 @@ public:
*/
void
GetSourceFiles
(
std
::
vector
<
std
::
string
>
&
files
)
const
;
void
GetSourceFiles
(
std
::
vector
<
cmSourceFile
*>
&
files
)
const
;
std
::
vector
<
std
::
string
>
const
&
GetObjectLibraries
()
const
{
return
this
->
ObjectLibraries
;
}
/**
* Add sources to the target.
...
...
@@ -686,7 +682,6 @@ private:
std
::
vector
<
cmCustomCommand
>
PreLinkCommands
;
std
::
vector
<
cmCustomCommand
>
PostBuildCommands
;
TargetType
TargetTypeValue
;
std
::
vector
<
std
::
string
>
ObjectLibraries
;
LinkLibraryVectorType
LinkLibraries
;
LinkLibraryVectorType
PrevLinkedLibraries
;
bool
LinkLibrariesAnalyzed
;
...
...
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