Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CMake
CMake
Commits
6a72b3c8
Commit
6a72b3c8
authored
Oct 17, 2015
by
Stephen Kelly
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export: Port interface to cmGeneratorTarget.
parent
1293c156
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
105 additions
and
107 deletions
+105
-107
Source/cmExportBuildFileGenerator.cxx
Source/cmExportBuildFileGenerator.cxx
+14
-15
Source/cmExportFileGenerator.cxx
Source/cmExportFileGenerator.cxx
+34
-35
Source/cmExportFileGenerator.h
Source/cmExportFileGenerator.h
+13
-10
Source/cmExportInstallFileGenerator.cxx
Source/cmExportInstallFileGenerator.cxx
+15
-16
Source/cmExportTryCompileFileGenerator.cxx
Source/cmExportTryCompileFileGenerator.cxx
+24
-27
Source/cmExportTryCompileFileGenerator.h
Source/cmExportTryCompileFileGenerator.h
+5
-4
No files found.
Source/cmExportBuildFileGenerator.cxx
View file @
6a72b3c8
...
...
@@ -50,7 +50,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
->
FindGeneratorTargetToUse
(
*
tei
);
expectedTargets
+=
sep
+
this
->
Namespace
+
te
->
Target
->
GetExportName
();
sep
=
" "
;
if
(
this
->
ExportedTargets
.
insert
(
te
->
Target
).
second
)
if
(
this
->
ExportedTargets
.
insert
(
te
).
second
)
{
this
->
Exports
.
push_back
(
te
);
}
...
...
@@ -80,45 +80,44 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
tei
!=
this
->
Exports
.
end
();
++
tei
)
{
cmGeneratorTarget
*
gte
=
*
tei
;
cmTarget
*
te
=
gte
->
Target
;
this
->
GenerateImportTargetCode
(
os
,
te
);
this
->
GenerateImportTargetCode
(
os
,
gte
);
te
->
AppendBuildInterfaceIncludes
();
g
te
->
Target
->
AppendBuildInterfaceIncludes
();
ImportPropertyMap
properties
;
this
->
PopulateInterfaceProperty
(
"INTERFACE_INCLUDE_DIRECTORIES"
,
te
,
this
->
PopulateInterfaceProperty
(
"INTERFACE_INCLUDE_DIRECTORIES"
,
g
te
,
cmGeneratorExpression
::
BuildInterface
,
properties
,
missingTargets
);
this
->
PopulateInterfaceProperty
(
"INTERFACE_SOURCES"
,
te
,
this
->
PopulateInterfaceProperty
(
"INTERFACE_SOURCES"
,
g
te
,
cmGeneratorExpression
::
BuildInterface
,
properties
,
missingTargets
);
this
->
PopulateInterfaceProperty
(
"INTERFACE_COMPILE_DEFINITIONS"
,
te
,
this
->
PopulateInterfaceProperty
(
"INTERFACE_COMPILE_DEFINITIONS"
,
g
te
,
cmGeneratorExpression
::
BuildInterface
,
properties
,
missingTargets
);
this
->
PopulateInterfaceProperty
(
"INTERFACE_COMPILE_OPTIONS"
,
te
,
this
->
PopulateInterfaceProperty
(
"INTERFACE_COMPILE_OPTIONS"
,
g
te
,
cmGeneratorExpression
::
BuildInterface
,
properties
,
missingTargets
);
this
->
PopulateInterfaceProperty
(
"INTERFACE_AUTOUIC_OPTIONS"
,
te
,
this
->
PopulateInterfaceProperty
(
"INTERFACE_AUTOUIC_OPTIONS"
,
g
te
,
cmGeneratorExpression
::
BuildInterface
,
properties
,
missingTargets
);
this
->
PopulateInterfaceProperty
(
"INTERFACE_COMPILE_FEATURES"
,
te
,
this
->
PopulateInterfaceProperty
(
"INTERFACE_COMPILE_FEATURES"
,
g
te
,
cmGeneratorExpression
::
BuildInterface
,
properties
,
missingTargets
);
this
->
PopulateInterfaceProperty
(
"INTERFACE_POSITION_INDEPENDENT_CODE"
,
te
,
properties
);
g
te
,
properties
);
const
bool
newCMP0022Behavior
=
te
->
GetPolicyStatusCMP0022
()
!=
cmPolicies
::
WARN
&&
te
->
GetPolicyStatusCMP0022
()
!=
cmPolicies
::
OLD
;
gte
->
Target
->
GetPolicyStatusCMP0022
()
!=
cmPolicies
::
WARN
&&
g
te
->
Target
->
GetPolicyStatusCMP0022
()
!=
cmPolicies
::
OLD
;
if
(
newCMP0022Behavior
)
{
this
->
PopulateInterfaceLinkLibrariesProperty
(
te
,
this
->
PopulateInterfaceLinkLibrariesProperty
(
g
te
,
cmGeneratorExpression
::
BuildInterface
,
properties
,
missingTargets
);
}
this
->
PopulateCompatibleInterfaceProperties
(
gte
,
properties
);
this
->
GenerateInterfaceProperties
(
te
,
os
,
properties
);
this
->
GenerateInterfaceProperties
(
g
te
,
os
,
properties
);
}
// Generate import file content for each configuration.
...
...
Source/cmExportFileGenerator.cxx
View file @
6a72b3c8
...
...
@@ -155,7 +155,7 @@ void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
//----------------------------------------------------------------------------
void
cmExportFileGenerator
::
PopulateInterfaceProperty
(
const
std
::
string
&
propName
,
cmTarget
*
target
,
cm
Generator
Target
*
target
,
ImportPropertyMap
&
properties
)
{
const
char
*
input
=
target
->
GetProperty
(
propName
);
...
...
@@ -169,7 +169,7 @@ void cmExportFileGenerator::PopulateInterfaceProperty(
void
cmExportFileGenerator
::
PopulateInterfaceProperty
(
const
std
::
string
&
propName
,
const
std
::
string
&
outputName
,
cmTarget
*
target
,
cm
Generator
Target
*
target
,
cmGeneratorExpression
::
PreprocessContext
preprocessRule
,
ImportPropertyMap
&
properties
,
std
::
vector
<
std
::
string
>
&
missingTargets
)
...
...
@@ -206,12 +206,12 @@ void cmExportFileGenerator::GenerateRequiredCMakeVersion(std::ostream& os,
//----------------------------------------------------------------------------
bool
cmExportFileGenerator
::
PopulateInterfaceLinkLibrariesProperty
(
cmTarget
*
target
,
cm
Generator
Target
*
target
,
cmGeneratorExpression
::
PreprocessContext
preprocessRule
,
ImportPropertyMap
&
properties
,
std
::
vector
<
std
::
string
>
&
missingTargets
)
{
if
(
!
target
->
IsLinkable
())
if
(
!
target
->
Target
->
IsLinkable
())
{
return
false
;
}
...
...
@@ -420,7 +420,7 @@ void cmExportFileGenerator::PopulateSourcesInterface(
true
);
if
(
!
prepro
.
empty
())
{
this
->
ResolveTargetsInGeneratorExpressions
(
prepro
,
gt
->
Target
,
this
->
ResolveTargetsInGeneratorExpressions
(
prepro
,
gt
,
missingTargets
);
if
(
!
checkInterfaceDirs
(
prepro
,
gt
,
propName
))
...
...
@@ -488,7 +488,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
true
);
if
(
!
prepro
.
empty
())
{
this
->
ResolveTargetsInGeneratorExpressions
(
prepro
,
target
->
Target
,
this
->
ResolveTargetsInGeneratorExpressions
(
prepro
,
target
,
missingTargets
);
if
(
!
checkInterfaceDirs
(
prepro
,
target
,
propName
))
...
...
@@ -502,7 +502,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
//----------------------------------------------------------------------------
void
cmExportFileGenerator
::
PopulateInterfaceProperty
(
const
std
::
string
&
propName
,
cmTarget
*
target
,
cm
Generator
Target
*
target
,
cmGeneratorExpression
::
PreprocessContext
preprocessRule
,
ImportPropertyMap
&
properties
,
std
::
vector
<
std
::
string
>
&
missingTargets
)
...
...
@@ -574,15 +574,14 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
cmGeneratorTarget
*
gtarget
,
ImportPropertyMap
&
properties
)
{
cmTarget
*
target
=
gtarget
->
Target
;
this
->
PopulateInterfaceProperty
(
"COMPATIBLE_INTERFACE_BOOL"
,
target
,
properties
);
g
target
,
properties
);
this
->
PopulateInterfaceProperty
(
"COMPATIBLE_INTERFACE_STRING"
,
target
,
properties
);
g
target
,
properties
);
this
->
PopulateInterfaceProperty
(
"COMPATIBLE_INTERFACE_NUMBER_MIN"
,
target
,
properties
);
g
target
,
properties
);
this
->
PopulateInterfaceProperty
(
"COMPATIBLE_INTERFACE_NUMBER_MAX"
,
target
,
properties
);
g
target
,
properties
);
std
::
set
<
std
::
string
>
ifaceProperties
;
...
...
@@ -593,12 +592,12 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
getPropertyContents
(
gtarget
,
"COMPATIBLE_INTERFACE_NUMBER_MAX"
,
ifaceProperties
);
if
(
target
->
GetType
()
!=
cmState
::
INTERFACE_LIBRARY
)
if
(
g
target
->
GetType
()
!=
cmState
::
INTERFACE_LIBRARY
)
{
getCompatibleInterfaceProperties
(
gtarget
,
ifaceProperties
,
""
);
std
::
vector
<
std
::
string
>
configNames
;
t
arget
->
GetMakefile
()
->
GetConfigurations
(
configNames
);
gtarget
->
T
arget
->
GetMakefile
()
->
GetConfigurations
(
configNames
);
for
(
std
::
vector
<
std
::
string
>::
const_iterator
ci
=
configNames
.
begin
();
ci
!=
configNames
.
end
();
++
ci
)
...
...
@@ -611,19 +610,20 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
it
!=
ifaceProperties
.
end
();
++
it
)
{
this
->
PopulateInterfaceProperty
(
"INTERFACE_"
+
*
it
,
target
,
properties
);
g
target
,
properties
);
}
}
//----------------------------------------------------------------------------
void
cmExportFileGenerator
::
GenerateInterfaceProperties
(
cmTarget
const
*
target
,
void
cmExportFileGenerator
::
GenerateInterfaceProperties
(
const
cmGeneratorTarget
*
target
,
std
::
ostream
&
os
,
const
ImportPropertyMap
&
properties
)
{
if
(
!
properties
.
empty
())
{
std
::
string
targetName
=
this
->
Namespace
;
targetName
+=
target
->
GetExportName
();
targetName
+=
target
->
Target
->
GetExportName
();
os
<<
"set_target_properties("
<<
targetName
<<
" PROPERTIES
\n
"
;
for
(
ImportPropertyMap
::
const_iterator
pi
=
properties
.
begin
();
pi
!=
properties
.
end
();
++
pi
)
...
...
@@ -638,12 +638,12 @@ void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget const* target,
//----------------------------------------------------------------------------
bool
cmExportFileGenerator
::
AddTargetNamespace
(
std
::
string
&
input
,
cmTarget
*
target
,
cm
Generator
Target
*
target
,
std
::
vector
<
std
::
string
>
&
missingTargets
)
{
cm
Makefile
*
mf
=
target
->
GetMakefile
();
cm
LocalGenerator
*
lg
=
target
->
GetLocalGenerator
();
cmTarget
*
tgt
=
mf
->
FindTargetToUse
(
input
);
cm
Generator
Target
*
tgt
=
lg
->
Find
Generator
TargetToUse
(
input
);
if
(
!
tgt
)
{
return
false
;
...
...
@@ -655,13 +655,14 @@ cmExportFileGenerator::AddTargetNamespace(std::string &input,
}
if
(
this
->
ExportedTargets
.
find
(
tgt
)
!=
this
->
ExportedTargets
.
end
())
{
input
=
this
->
Namespace
+
tgt
->
GetExportName
();
input
=
this
->
Namespace
+
tgt
->
Target
->
GetExportName
();
}
else
{
std
::
string
namespacedTarget
;
this
->
HandleMissingTarget
(
namespacedTarget
,
missingTargets
,
mf
,
target
,
tgt
);
target
->
Target
->
GetMakefile
(),
target
->
Target
,
tgt
->
Target
);
if
(
!
namespacedTarget
.
empty
())
{
input
=
namespacedTarget
;
...
...
@@ -674,7 +675,7 @@ cmExportFileGenerator::AddTargetNamespace(std::string &input,
void
cmExportFileGenerator
::
ResolveTargetsInGeneratorExpressions
(
std
::
string
&
input
,
cmTarget
*
target
,
cm
Generator
Target
*
target
,
std
::
vector
<
std
::
string
>
&
missingTargets
,
FreeTargetsReplace
replace
)
{
...
...
@@ -711,14 +712,12 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
void
cmExportFileGenerator
::
ResolveTargetsInGeneratorExpression
(
std
::
string
&
input
,
cmTarget
*
target
,
cm
Generator
Target
*
target
,
std
::
vector
<
std
::
string
>
&
missingTargets
)
{
std
::
string
::
size_type
pos
=
0
;
std
::
string
::
size_type
lastPos
=
pos
;
cmMakefile
*
mf
=
target
->
GetMakefile
();
while
((
pos
=
input
.
find
(
"$<TARGET_PROPERTY:"
,
lastPos
))
!=
input
.
npos
)
{
std
::
string
::
size_type
nameStartPos
=
pos
+
...
...
@@ -779,7 +778,7 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
if
(
!
errorString
.
empty
())
{
mf
->
IssueMessage
(
cmake
::
FATAL_ERROR
,
errorString
);
target
->
GetLocalGenerator
()
->
IssueMessage
(
cmake
::
FATAL_ERROR
,
errorString
);
}
}
...
...
@@ -860,7 +859,7 @@ cmExportFileGenerator
preprocessRule
);
if
(
!
prepro
.
empty
())
{
this
->
ResolveTargetsInGeneratorExpressions
(
prepro
,
target
->
Target
,
this
->
ResolveTargetsInGeneratorExpressions
(
prepro
,
target
,
missingTargets
,
ReplaceFreeTargets
);
properties
[
"IMPORTED_LINK_INTERFACE_LIBRARIES"
+
suffix
]
=
prepro
;
...
...
@@ -962,7 +961,7 @@ cmExportFileGenerator
sep
=
";"
;
std
::
string
temp
=
*
li
;
this
->
AddTargetNamespace
(
temp
,
target
->
Target
,
missingTargets
);
this
->
AddTargetNamespace
(
temp
,
target
,
missingTargets
);
link_entries
+=
temp
;
}
...
...
@@ -1044,12 +1043,12 @@ void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os,
//----------------------------------------------------------------------------
void
cmExportFileGenerator
::
GenerateImportTargetCode
(
std
::
ostream
&
os
,
c
mTarget
cons
t
*
target
)
::
GenerateImportTargetCode
(
std
::
ostream
&
os
,
c
onst
cmGeneratorTarge
t
*
target
)
{
// Construct the imported target name.
std
::
string
targetName
=
this
->
Namespace
;
targetName
+=
target
->
GetExportName
();
targetName
+=
target
->
Target
->
GetExportName
();
// Create the imported target.
os
<<
"# Create imported target "
<<
targetName
<<
"
\n
"
;
...
...
@@ -1078,27 +1077,27 @@ cmExportFileGenerator
}
// Mark the imported executable if it has exports.
if
(
target
->
IsExecutableWithExports
())
if
(
target
->
Target
->
IsExecutableWithExports
())
{
os
<<
"set_property(TARGET "
<<
targetName
<<
" PROPERTY ENABLE_EXPORTS 1)
\n
"
;
}
// Mark the imported library if it is a framework.
if
(
target
->
IsFrameworkOnApple
())
if
(
target
->
Target
->
IsFrameworkOnApple
())
{
os
<<
"set_property(TARGET "
<<
targetName
<<
" PROPERTY FRAMEWORK 1)
\n
"
;
}
// Mark the imported executable if it is an application bundle.
if
(
target
->
IsAppBundleOnApple
())
if
(
target
->
Target
->
IsAppBundleOnApple
())
{
os
<<
"set_property(TARGET "
<<
targetName
<<
" PROPERTY MACOSX_BUNDLE 1)
\n
"
;
}
if
(
target
->
IsCFBundleOnApple
())
if
(
target
->
Target
->
IsCFBundleOnApple
())
{
os
<<
"set_property(TARGET "
<<
targetName
<<
" PROPERTY BUNDLE 1)
\n
"
;
...
...
Source/cmExportFileGenerator.h
View file @
6a72b3c8
...
...
@@ -75,7 +75,8 @@ protected:
const
std
::
string
&
config
=
""
);
void
GenerateImportFooterCode
(
std
::
ostream
&
os
);
void
GenerateImportVersionCode
(
std
::
ostream
&
os
);
void
GenerateImportTargetCode
(
std
::
ostream
&
os
,
cmTarget
const
*
target
);
void
GenerateImportTargetCode
(
std
::
ostream
&
os
,
cmGeneratorTarget
const
*
target
);
void
GenerateImportPropertyCode
(
std
::
ostream
&
os
,
const
std
::
string
&
config
,
cmTarget
const
*
target
,
ImportPropertyMap
const
&
properties
);
...
...
@@ -122,19 +123,21 @@ protected:
cmTarget
*
depender
,
cmTarget
*
dependee
)
=
0
;
void
PopulateInterfaceProperty
(
const
std
::
string
&
,
cmTarget
*
target
,
cm
Generator
Target
*
target
,
cmGeneratorExpression
::
PreprocessContext
,
ImportPropertyMap
&
properties
,
std
::
vector
<
std
::
string
>
&
missingTargets
);
bool
PopulateInterfaceLinkLibrariesProperty
(
cmTarget
*
target
,
bool
PopulateInterfaceLinkLibrariesProperty
(
cm
Generator
Target
*
target
,
cmGeneratorExpression
::
PreprocessContext
,
ImportPropertyMap
&
properties
,
std
::
vector
<
std
::
string
>
&
missingTargets
);
void
PopulateInterfaceProperty
(
const
std
::
string
&
propName
,
cmTarget
*
target
,
void
PopulateInterfaceProperty
(
const
std
::
string
&
propName
,
cmGeneratorTarget
*
target
,
ImportPropertyMap
&
properties
);
void
PopulateCompatibleInterfaceProperties
(
cmGeneratorTarget
*
target
,
ImportPropertyMap
&
properties
);
void
GenerateInterfaceProperties
(
cmTarget
const
*
target
,
std
::
ostream
&
os
,
void
GenerateInterfaceProperties
(
cmGeneratorTarget
const
*
target
,
std
::
ostream
&
os
,
const
ImportPropertyMap
&
properties
);
void
PopulateIncludeDirectoriesInterface
(
cmTargetExport
*
target
,
...
...
@@ -159,7 +162,7 @@ protected:
};
void
ResolveTargetsInGeneratorExpressions
(
std
::
string
&
input
,
cmTarget
*
target
,
cm
Generator
Target
*
target
,
std
::
vector
<
std
::
string
>
&
missingTargets
,
FreeTargetsReplace
replace
=
NoReplaceFreeTargets
);
...
...
@@ -182,20 +185,20 @@ protected:
bool
AppendMode
;
// The set of targets included in the export.
std
::
set
<
cmTarget
*>
ExportedTargets
;
std
::
set
<
cm
Generator
Target
*>
ExportedTargets
;
private:
void
PopulateInterfaceProperty
(
const
std
::
string
&
,
const
std
::
string
&
,
cmTarget
*
target
,
cm
Generator
Target
*
target
,
cmGeneratorExpression
::
PreprocessContext
,
ImportPropertyMap
&
properties
,
std
::
vector
<
std
::
string
>
&
missingTargets
);
bool
AddTargetNamespace
(
std
::
string
&
input
,
cmTarget
*
target
,
bool
AddTargetNamespace
(
std
::
string
&
input
,
cm
Generator
Target
*
target
,
std
::
vector
<
std
::
string
>
&
missingTargets
);
void
ResolveTargetsInGeneratorExpression
(
std
::
string
&
input
,
cmTarget
*
target
,
cm
Generator
Target
*
target
,
std
::
vector
<
std
::
string
>
&
missingTargets
);
virtual
void
ReplaceInstallPrefix
(
std
::
string
&
input
);
...
...
Source/cmExportInstallFileGenerator.cxx
View file @
6a72b3c8
...
...
@@ -52,7 +52,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
sep
+
this
->
Namespace
+
(
*
tei
)
->
Target
->
Target
->
GetExportName
();
sep
=
" "
;
cmTargetExport
*
te
=
*
tei
;
if
(
this
->
ExportedTargets
.
insert
(
te
->
Target
->
Target
).
second
)
if
(
this
->
ExportedTargets
.
insert
(
te
->
Target
).
second
)
{
allTargets
.
push_back
(
te
);
}
...
...
@@ -133,12 +133,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
tei
!=
allTargets
.
end
();
++
tei
)
{
cmGeneratorTarget
*
gt
=
(
*
tei
)
->
Target
;
cmTarget
*
te
=
gt
->
Target
;
requiresConfigFiles
=
requiresConfigFiles
||
t
e
->
GetType
()
!=
cmState
::
INTERFACE_LIBRARY
;
||
g
t
->
GetType
()
!=
cmState
::
INTERFACE_LIBRARY
;
this
->
GenerateImportTargetCode
(
os
,
t
e
);
this
->
GenerateImportTargetCode
(
os
,
g
t
);
ImportPropertyMap
properties
;
...
...
@@ -149,32 +148,32 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
cmGeneratorExpression
::
InstallInterface
,
properties
,
missingTargets
);
this
->
PopulateInterfaceProperty
(
"INTERFACE_SYSTEM_INCLUDE_DIRECTORIES"
,
t
e
,
g
t
,
cmGeneratorExpression
::
InstallInterface
,
properties
,
missingTargets
);
this
->
PopulateInterfaceProperty
(
"INTERFACE_COMPILE_DEFINITIONS"
,
t
e
,
g
t
,
cmGeneratorExpression
::
InstallInterface
,
properties
,
missingTargets
);
this
->
PopulateInterfaceProperty
(
"INTERFACE_COMPILE_OPTIONS"
,
t
e
,
g
t
,
cmGeneratorExpression
::
InstallInterface
,
properties
,
missingTargets
);
this
->
PopulateInterfaceProperty
(
"INTERFACE_AUTOUIC_OPTIONS"
,
t
e
,
g
t
,
cmGeneratorExpression
::
InstallInterface
,
properties
,
missingTargets
);
this
->
PopulateInterfaceProperty
(
"INTERFACE_COMPILE_FEATURES"
,
t
e
,
g
t
,
cmGeneratorExpression
::
InstallInterface
,
properties
,
missingTargets
);
const
bool
newCMP0022Behavior
=
te
->
GetPolicyStatusCMP0022
()
!=
cmPolicies
::
WARN
&&
t
e
->
GetPolicyStatusCMP0022
()
!=
cmPolicies
::
OLD
;
gt
->
Target
->
GetPolicyStatusCMP0022
()
!=
cmPolicies
::
WARN
&&
gt
->
Targe
t
->
GetPolicyStatusCMP0022
()
!=
cmPolicies
::
OLD
;
if
(
newCMP0022Behavior
)
{
if
(
this
->
PopulateInterfaceLinkLibrariesProperty
(
t
e
,
if
(
this
->
PopulateInterfaceLinkLibrariesProperty
(
g
t
,
cmGeneratorExpression
::
InstallInterface
,
properties
,
missingTargets
)
&&
!
this
->
ExportOld
)
...
...
@@ -182,11 +181,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
require2_8_12
=
true
;
}
}
if
(
t
e
->
GetType
()
==
cmState
::
INTERFACE_LIBRARY
)
if
(
g
t
->
GetType
()
==
cmState
::
INTERFACE_LIBRARY
)
{
require3_0_0
=
true
;
}
if
(
t
e
->
GetProperty
(
"INTERFACE_SOURCES"
))
if
(
g
t
->
GetProperty
(
"INTERFACE_SOURCES"
))
{
// We can only generate INTERFACE_SOURCES in CMake 3.3, but CMake 3.1
// can consume them.
...
...
@@ -194,11 +193,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
}
this
->
PopulateInterfaceProperty
(
"INTERFACE_POSITION_INDEPENDENT_CODE"
,
t
e
,
properties
);
g
t
,
properties
);
this
->
PopulateCompatibleInterfaceProperties
(
gt
,
properties
);
this
->
GenerateInterfaceProperties
(
gt
->
Target
,
os
,
properties
);
this
->
GenerateInterfaceProperties
(
gt
,
os
,
properties
);
}
if
(
require3_1_0
)
...
...
Source/cmExportTryCompileFileGenerator.cxx
View file @
6a72b3c8
...
...
@@ -28,38 +28,38 @@ cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator(
bool
cmExportTryCompileFileGenerator
::
GenerateMainFile
(
std
::
ostream
&
os
)
{
std
::
set
<
cmTarget
const
*>
emitted
;
std
::
set
<
cmTarget
const
*>
emittedDeps
;
std
::
set
<
cm
Generator
Target
const
*>
emitted
;
std
::
set
<
cm
Generator
Target
const
*>
emittedDeps
;
while
(
!
this
->
Exports
.
empty
())
{
cmGeneratorTarget
const
*
te
=
this
->
Exports
.
back
();
this
->
Exports
.
pop_back
();
if
(
emitted
.
insert
(
te
->
Target
).
second
)
if
(
emitted
.
insert
(
te
).
second
)
{
emittedDeps
.
insert
(
te
->
Target
);
this
->
GenerateImportTargetCode
(
os
,
te
->
Target
);
emittedDeps
.
insert
(
te
);
this
->
GenerateImportTargetCode
(
os
,
te
);
ImportPropertyMap
properties
;
#define FIND_TARGETS(PROPERTY) \
this->FindTargets("INTERFACE_" #PROPERTY, te
->Target
, emittedDeps);
this->FindTargets("INTERFACE_" #PROPERTY, te, emittedDeps);
CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME
(
FIND_TARGETS
)
#undef FIND_TARGETS
this
->
PopulateProperties
(
te
->
Target
,
properties
,
emittedDeps
);
this
->
PopulateProperties
(
te
,
properties
,
emittedDeps
);
this
->
GenerateInterfaceProperties
(
te
->
Target
,
os
,
properties
);
this
->
GenerateInterfaceProperties
(
te
,
os
,
properties
);
}
}
return
true
;
}
std
::
string
cmExportTryCompileFileGenerator
::
FindTargets
(
const
std
::
string
&
propName
,
cm
Target
const
*
tgt
,
std
::
set
<
cmTarget
const
*>
&
emitted
)
const
std
::
string
&
propName
,
cmGenerator
Target
const
*
tgt
,
std
::
set
<
cm
Generator
Target
const
*>
&
emitted
)
{
const
char
*
prop
=
tgt
->
GetProperty
(
propName
);
if
(
!
prop
)
...
...
@@ -77,24 +77,22 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
cmTarget
dummyHead
;
dummyHead
.
SetType
(
cmState
::
EXECUTABLE
,
"try_compile_dummy_exe"
);
dummyHead
.
SetMakefile
(
tgt
->
GetMakefile
());
dummyHead
.
SetMakefile
(
tgt
->
Target
->
GetMakefile
());
cmGeneratorTarget
*
gtgt
=
tgt
->
GetMakefile
()
->
GetGlobalGenerator
()
->
GetGeneratorTarget
(
tgt
);
cmGeneratorTarget
gDummyHead
(
&
dummyHead
,
gtgt
->
GetLocalGenerator
());
cmGeneratorTarget
gDummyHead
(
&
dummyHead
,
tgt
->
GetLocalGenerator
());
std
::
string
result
=
cge
->
Evaluate
(
g
tgt
->
GetLocalGenerator
(),
this
->
Config
,
std
::
string
result
=
cge
->
Evaluate
(
tgt
->
GetLocalGenerator
(),
this
->
Config
,
false
,
&
gDummyHead
,
g
tgt
,
&
dagChecker
);
tgt
,
&
dagChecker
);
const
std
::
set
<
cmGeneratorTarget
const
*>
&
allTargets
=
cge
->
GetAllTargetsSeen
();
for
(
std
::
set
<
cmGeneratorTarget
const
*>::
const_iterator
li
=
allTargets
.
begin
();
li
!=
allTargets
.
end
();
++
li
)
{
if
(
emitted
.
insert
(
(
*
li
)
->
Target
)
.
second
)
if
(
emitted
.
insert
(
*
li
).
second
)
{
this
->
Exports
.
push_back
(
(
*
li
)
)
;
this
->
Exports
.
push_back
(
*
li
);
}
}
return
result
;
...
...
@@ -102,13 +100,12 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
//----------------------------------------------------------------------------
void
cmExportTryCompileFileGenerator
::
PopulateProperties
(
cmTarget
const
*
target
,
ImportPropertyMap
&
properties
,
std
::
set
<
cmTarget
const
*>
&
emitted
)
cmExportTryCompileFileGenerator
::
PopulateProperties
(
const
cmGeneratorTarget
*
target
,
ImportPropertyMap
&
properties
,
std
::
set
<
cmGeneratorTarget
const
*>
&
emitted
)
{
cmPropertyMap
props
=
target
->
GetProperties
();
cmGeneratorTarget
*
gt
=
target
->
GetMakefile
()
->
GetGlobalGenerator
()
->
GetGeneratorTarget
(
target
);
cmPropertyMap
props
=
target
->
Target
->
GetProperties
();
for
(
cmPropertyMap
::
const_iterator
i
=
props
.
begin
();
i
!=
props
.
end
();
++
i
)
{
properties
[
i
->
first
]
=
i
->
second
.
GetValue
();
...
...
@@ -126,8 +123,8 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target,
li
!=
depends
.
end
();
++
li
)
{
cmGeneratorTarget
*
tgt
=
g
t
->
GetLocalGenerator
()
->
FindGeneratorTargetToUse
(
*
li
);
if
(
tgt
&&
emitted
.
insert
(
tgt
->
Target
).
second
)
targe
t
->
GetLocalGenerator
()
->
FindGeneratorTargetToUse
(
*
li
);
if
(
tgt
&&
emitted
.
insert
(
tgt
).
second
)
{
this
->
Exports
.
push_back
(
tgt
);
}
...
...
Source/cmExportTryCompileFileGenerator.h
View file @
6a72b3c8
...
...
@@ -41,15 +41,16 @@ protected:
cmTarget
*
,
cmTarget
*
)
{}
void
PopulateProperties
(
cmTarget
const
*
target
,
void
PopulateProperties
(
cm
Generator
Target
const
*
target
,
ImportPropertyMap
&
properties
,
std
::
set
<
c
mTarget
const
*>
&
emitted
);
std
::
set
<
c
onst
cmGeneratorTarget
*>&
emitted
);
std
::
string
InstallNameDir
(
cmGeneratorTarget
*
target
,
const
std
::
string
&
config
);
private:
std
::
string
FindTargets
(
const
std
::
string
&
prop
,
cmTarget
const
*
tgt
,
std
::
set
<
cmTarget
const
*>
&
emitted
);
std
::
string
FindTargets
(
const
std
::
string
&
prop
,
const
cmGeneratorTarget
*
tgt
,
std
::
set
<
const
cmGeneratorTarget
*>&
emitted
);