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
Dennis Klein
CMake
Commits
8b016886
Commit
8b016886
authored
Oct 20, 2014
by
Stephen Kelly
Browse files
cmGeneratorTarget: Move GetDirectory from cmTarget.
parent
e0261a1e
Changes
15
Hide whitespace changes
Inline
Side-by-side
Source/cmGeneratorExpressionNode.cxx
View file @
8b016886
...
...
@@ -1586,7 +1586,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag>
"SHARED libraries."
);
return
std
::
string
();
}
std
::
string
result
=
target
->
Target
->
GetDirectory
(
context
->
Config
);
std
::
string
result
=
target
->
GetDirectory
(
context
->
Config
);
result
+=
"/"
;
result
+=
target
->
GetSOName
(
context
->
Config
);
return
result
;
...
...
Source/cmGeneratorTarget.cxx
View file @
8b016886
...
...
@@ -748,7 +748,7 @@ const char* cmGeneratorTarget::GetLocationForBuild() const
}
// Now handle the deprecated build-time configuration location.
location
=
this
->
Target
->
GetDirectory
();
location
=
this
->
GetDirectory
();
const
char
*
cfgid
=
this
->
Makefile
->
GetDefinition
(
"CMAKE_CFG_INTDIR"
);
if
(
cfgid
&&
strcmp
(
cfgid
,
"."
)
!=
0
)
{
...
...
@@ -1434,7 +1434,7 @@ cmGeneratorTarget::GetInstallNameDirForBuildTree(
}
else
{
dir
=
this
->
Target
->
GetDirectory
(
config
);
dir
=
this
->
GetDirectory
(
config
);
}
dir
+=
"/"
;
return
dir
;
...
...
@@ -1735,7 +1735,7 @@ cmGeneratorTarget::GetMacContentDirectory(const std::string& config,
bool
implib
)
const
{
// Start with the output directory for the target.
std
::
string
fpath
=
this
->
Target
->
GetDirectory
(
config
,
implib
);
std
::
string
fpath
=
this
->
GetDirectory
(
config
,
implib
);
fpath
+=
"/"
;
bool
contentOnly
=
true
;
if
(
this
->
Target
->
IsFrameworkOnApple
())
...
...
@@ -2860,7 +2860,7 @@ void cmGeneratorTarget::ComputeTargetManifest(
}
// Get the directory.
std
::
string
dir
=
this
->
Target
->
GetDirectory
(
config
,
false
);
std
::
string
dir
=
this
->
GetDirectory
(
config
,
false
);
// Add each name.
std
::
string
f
;
...
...
@@ -2894,7 +2894,7 @@ void cmGeneratorTarget::ComputeTargetManifest(
}
if
(
!
impName
.
empty
())
{
f
=
this
->
Target
->
GetDirectory
(
config
,
true
);
f
=
this
->
GetDirectory
(
config
,
true
);
f
+=
"/"
;
f
+=
impName
;
gg
->
AddToManifest
(
f
);
...
...
@@ -2919,7 +2919,7 @@ std::string cmGeneratorTarget::NormalGetFullPath(const std::string& config,
bool
implib
,
bool
realname
)
const
{
std
::
string
fpath
=
this
->
Target
->
GetDirectory
(
config
,
implib
);
std
::
string
fpath
=
this
->
GetDirectory
(
config
,
implib
);
fpath
+=
"/"
;
if
(
this
->
Target
->
IsAppBundleOnApple
())
{
...
...
@@ -4453,6 +4453,26 @@ cmGeneratorTarget::GetLinkInterfaceLibraries(const std::string& config,
return
iface
.
Exists
?
&
iface
:
0
;
}
//----------------------------------------------------------------------------
std
::
string
cmGeneratorTarget
::
GetDirectory
(
const
std
::
string
&
config
,
bool
implib
)
const
{
if
(
this
->
Target
->
IsImported
())
{
// Return the directory from which the target is imported.
return
cmSystemTools
::
GetFilenamePath
(
this
->
Target
->
ImportedGetFullPath
(
config
,
implib
));
}
else
if
(
cmTarget
::
OutputInfo
const
*
info
=
this
->
Target
->
GetOutputInfo
(
config
))
{
// Return the directory in which the target will be built.
return
implib
?
info
->
ImpDir
:
info
->
OutDir
;
}
return
""
;
}
//----------------------------------------------------------------------------
void
cmGeneratorTarget
::
ComputeLinkInterfaceLibraries
(
...
...
Source/cmGeneratorTarget.h
View file @
8b016886
...
...
@@ -268,6 +268,13 @@ public:
*/
void
TraceDependencies
();
/** Get the directory in which this target will be built. If the
configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
output directory is given. */
std
::
string
GetDirectory
(
const
std
::
string
&
config
=
""
,
bool
implib
=
false
)
const
;
/** Get the directory in which to place the target compiler .pdb file.
If the configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
...
...
Source/cmGlobalXCodeGenerator.cxx
View file @
8b016886
...
...
@@ -1977,7 +1977,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
if
(
!
target
.
UsesDefaultOutputDir
(
configName
,
false
))
{
std
::
string
pncdir
=
target
.
GetDirectory
(
configName
);
std
::
string
pncdir
=
gtgt
->
GetDirectory
(
configName
);
buildSettings
->
AddAttribute
(
"CONFIGURATION_BUILD_DIR"
,
this
->
CreateString
(
pncdir
.
c_str
()));
}
...
...
@@ -1986,7 +1986,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
buildSettings
->
AddAttribute
(
"OBJROOT"
,
this
->
CreateString
(
pndir
.
c_str
()));
pndir
=
target
.
GetDirectory
(
configName
);
pndir
=
gtgt
->
GetDirectory
(
configName
);
}
if
(
target
.
IsFrameworkOnApple
()
||
target
.
IsCFBundleOnApple
())
...
...
Source/cmInstallTargetGenerator.cxx
View file @
8b016886
...
...
@@ -83,7 +83,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
else
{
fromDirConfig
=
this
->
Target
->
Target
->
GetDirectory
(
config
,
this
->
ImportLibrary
);
this
->
Target
->
GetDirectory
(
config
,
this
->
ImportLibrary
);
fromDirConfig
+=
"/"
;
}
std
::
string
toDir
=
...
...
Source/cmLocalVisualStudio6Generator.cxx
View file @
8b016886
...
...
@@ -805,7 +805,11 @@ cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target,
// VS6 forgets to create the output directory for archives if it
// differs from the intermediate directory.
if
(
target
.
GetType
()
!=
cmTarget
::
STATIC_LIBRARY
)
{
return
pcc
;
}
std
::
string
outDir
=
target
.
GetDirectory
(
config
,
false
);
cmGeneratorTarget
*
gt
=
this
->
GlobalGenerator
->
GetGeneratorTarget
(
&
target
);
std
::
string
outDir
=
gt
->
GetDirectory
(
config
,
false
);
// Add a pre-link event to create the directory.
cmCustomCommandLine
command
;
...
...
@@ -1363,20 +1367,20 @@ void cmLocalVisualStudio6Generator
#ifdef CM_USE_OLD_VS6
outputDirOld
=
removeQuotes
(
this
->
ConvertToOutputFormat
(
target
.
GetDirectory
().
c_str
(),
SHELL
));
(
gt
->
GetDirectory
().
c_str
(),
SHELL
));
#endif
outputDirDebug
=
removeQuotes
(
this
->
ConvertToOutputFormat
(
target
.
GetDirectory
(
"Debug"
).
c_str
(),
SHELL
));
gt
->
GetDirectory
(
"Debug"
).
c_str
(),
SHELL
));
outputDirRelease
=
removeQuotes
(
this
->
ConvertToOutputFormat
(
target
.
GetDirectory
(
"Release"
).
c_str
(),
SHELL
));
gt
->
GetDirectory
(
"Release"
).
c_str
(),
SHELL
));
outputDirMinSizeRel
=
removeQuotes
(
this
->
ConvertToOutputFormat
(
target
.
GetDirectory
(
"MinSizeRel"
).
c_str
(),
SHELL
));
gt
->
GetDirectory
(
"MinSizeRel"
).
c_str
(),
SHELL
));
outputDirRelWithDebInfo
=
removeQuotes
(
this
->
ConvertToOutputFormat
(
target
.
GetDirectory
(
"RelWithDebInfo"
).
c_str
(),
SHELL
));
gt
->
GetDirectory
(
"RelWithDebInfo"
).
c_str
(),
SHELL
));
}
else
if
(
target
.
GetType
()
==
cmTarget
::
OBJECT_LIBRARY
)
{
...
...
@@ -1424,12 +1428,12 @@ void cmLocalVisualStudio6Generator
target
.
GetType
()
==
cmTarget
::
MODULE_LIBRARY
||
target
.
GetType
()
==
cmTarget
::
EXECUTABLE
)
{
std
::
string
fullPathImpDebug
=
target
.
GetDirectory
(
"Debug"
,
true
);
std
::
string
fullPathImpRelease
=
target
.
GetDirectory
(
"Release"
,
true
);
std
::
string
fullPathImpDebug
=
gt
->
GetDirectory
(
"Debug"
,
true
);
std
::
string
fullPathImpRelease
=
gt
->
GetDirectory
(
"Release"
,
true
);
std
::
string
fullPathImpMinSizeRel
=
target
.
GetDirectory
(
"MinSizeRel"
,
true
);
gt
->
GetDirectory
(
"MinSizeRel"
,
true
);
std
::
string
fullPathImpRelWithDebInfo
=
target
.
GetDirectory
(
"RelWithDebInfo"
,
true
);
gt
->
GetDirectory
(
"RelWithDebInfo"
,
true
);
fullPathImpDebug
+=
"/"
;
fullPathImpRelease
+=
"/"
;
fullPathImpMinSizeRel
+=
"/"
;
...
...
Source/cmLocalVisualStudio7Generator.cxx
View file @
8b016886
...
...
@@ -792,7 +792,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
{
std
::
string
const
&
outDir
=
target
.
GetType
()
==
cmTarget
::
OBJECT_LIBRARY
?
intermediateDir
:
target
.
GetDirectory
(
configName
);
intermediateDir
:
gt
->
GetDirectory
(
configName
);
fout
<<
"
\t\t\t
OutputDirectory=
\"
"
<<
this
->
ConvertToXMLOutputPathSingle
(
outDir
.
c_str
())
<<
"
\"\n
"
;
}
...
...
@@ -1004,7 +1004,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
// Check if we need the FAT32 workaround.
// Check the filesystem type where the target will be written.
if
(
cmLVS6G_IsFAT
(
target
.
GetDirectory
(
configName
).
c_str
()))
if
(
cmLVS6G_IsFAT
(
gt
->
GetDirectory
(
configName
).
c_str
()))
{
// Add a flag telling the manifest tool to use a workaround
// for FAT32 file systems, which can cause an empty manifest
...
...
@@ -1130,7 +1130,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
case
cmTarget
::
STATIC_LIBRARY
:
{
std
::
string
targetNameFull
=
gt
->
GetFullName
(
configName
);
std
::
string
libpath
=
target
.
GetDirectory
(
configName
);
std
::
string
libpath
=
gt
->
GetDirectory
(
configName
);
libpath
+=
"/"
;
libpath
+=
targetNameFull
;
const
char
*
tool
=
"VCLibrarianTool"
;
...
...
@@ -1210,7 +1210,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
fout
<<
" "
;
this
->
Internal
->
OutputLibraries
(
fout
,
cli
.
GetItems
());
fout
<<
"
\"\n
"
;
temp
=
target
.
GetDirectory
(
configName
);
temp
=
gt
->
GetDirectory
(
configName
);
temp
+=
"/"
;
temp
+=
targetNameFull
;
fout
<<
"
\t\t\t\t
OutputFile=
\"
"
...
...
@@ -1248,7 +1248,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
{
fout
<<
"
\t\t\t\t
StackReserveSize=
\"
"
<<
stackVal
<<
"
\"\n
"
;
}
temp
=
target
.
GetDirectory
(
configName
,
true
);
temp
=
gt
->
GetDirectory
(
configName
,
true
);
temp
+=
"/"
;
temp
+=
targetNameImport
;
fout
<<
"
\t\t\t\t
ImportLibrary=
\"
"
...
...
@@ -1309,7 +1309,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
fout
<<
" "
;
this
->
Internal
->
OutputLibraries
(
fout
,
cli
.
GetItems
());
fout
<<
"
\"\n
"
;
temp
=
target
.
GetDirectory
(
configName
);
temp
=
gt
->
GetDirectory
(
configName
);
temp
+=
"/"
;
temp
+=
targetNameFull
;
fout
<<
"
\t\t\t\t
OutputFile=
\"
"
...
...
@@ -1367,7 +1367,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
{
fout
<<
"
\t\t\t\t
StackReserveSize=
\"
"
<<
stackVal
<<
"
\"
"
;
}
temp
=
target
.
GetDirectory
(
configName
,
true
);
temp
=
gt
->
GetDirectory
(
configName
,
true
);
temp
+=
"/"
;
temp
+=
targetNameImport
;
fout
<<
"
\t\t\t\t
ImportLibrary=
\"
"
...
...
Source/cmLocalVisualStudioGenerator.cxx
View file @
8b016886
...
...
@@ -92,8 +92,10 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target,
if
(
target
.
GetType
()
!=
cmTarget
::
EXECUTABLE
&&
!
(
isFortran
&&
target
.
GetType
()
==
cmTarget
::
SHARED_LIBRARY
))
{
return
pcc
;
}
std
::
string
outDir
=
target
.
GetDirectory
(
config
,
false
);
std
::
string
impDir
=
target
.
GetDirectory
(
config
,
true
);
cmGeneratorTarget
*
gt
=
this
->
GetGlobalGenerator
()
->
GetGeneratorTarget
(
&
target
);
std
::
string
outDir
=
gt
->
GetDirectory
(
config
,
false
);
std
::
string
impDir
=
gt
->
GetDirectory
(
config
,
true
);
if
(
impDir
==
outDir
)
{
return
pcc
;
}
// Add a pre-build event to create the directory.
...
...
Source/cmMakefileExecutableTargetGenerator.cxx
View file @
8b016886
...
...
@@ -99,7 +99,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this
->
ConfigName
);
// Construct the full path version of the names.
std
::
string
outpath
=
this
->
Target
->
GetDirectory
(
this
->
ConfigName
);
std
::
string
outpath
=
this
->
Generator
Target
->
GetDirectory
(
this
->
ConfigName
);
if
(
this
->
Target
->
IsAppBundleOnApple
())
{
this
->
OSXBundleGenerator
->
CreateAppBundle
(
targetName
,
outpath
);
...
...
@@ -123,7 +123,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
cmSystemTools
::
MakeDirectory
(
outpath
.
c_str
());
if
(
!
targetNameImport
.
empty
())
{
outpathImp
=
this
->
Target
->
GetDirectory
(
this
->
ConfigName
,
true
);
outpathImp
=
this
->
Generator
Target
->
GetDirectory
(
this
->
ConfigName
,
true
);
cmSystemTools
::
MakeDirectory
(
outpathImp
.
c_str
());
outpathImp
+=
"/"
;
}
...
...
Source/cmMakefileLibraryTargetGenerator.cxx
View file @
8b016886
...
...
@@ -275,13 +275,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std
::
string
outpathImp
;
if
(
this
->
Target
->
IsFrameworkOnApple
())
{
outpath
=
this
->
Target
->
GetDirectory
(
this
->
ConfigName
);
outpath
=
this
->
Generator
Target
->
GetDirectory
(
this
->
ConfigName
);
this
->
OSXBundleGenerator
->
CreateFramework
(
targetName
,
outpath
);
outpath
+=
"/"
;
}
else
if
(
this
->
Target
->
IsCFBundleOnApple
())
{
outpath
=
this
->
Target
->
GetDirectory
(
this
->
ConfigName
);
outpath
=
this
->
Generator
Target
->
GetDirectory
(
this
->
ConfigName
);
this
->
OSXBundleGenerator
->
CreateCFBundle
(
targetName
,
outpath
);
outpath
+=
"/"
;
}
...
...
@@ -299,12 +299,12 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
}
else
{
outpath
=
this
->
Target
->
GetDirectory
(
this
->
ConfigName
);
outpath
=
this
->
Generator
Target
->
GetDirectory
(
this
->
ConfigName
);
cmSystemTools
::
MakeDirectory
(
outpath
.
c_str
());
outpath
+=
"/"
;
if
(
!
targetNameImport
.
empty
())
{
outpathImp
=
this
->
Target
->
GetDirectory
(
this
->
ConfigName
,
true
);
outpathImp
=
this
->
Generator
Target
->
GetDirectory
(
this
->
ConfigName
,
true
);
cmSystemTools
::
MakeDirectory
(
outpathImp
.
c_str
());
outpathImp
+=
"/"
;
}
...
...
Source/cmNinjaNormalTargetGenerator.cxx
View file @
8b016886
...
...
@@ -59,7 +59,7 @@ cmNinjaNormalTargetGenerator(cmGeneratorTarget* target)
{
// on Windows the output dir is already needed at compile time
// ensure the directory exists (OutDir test)
EnsureDirectoryExists
(
target
->
Target
->
GetDirectory
(
this
->
GetConfigName
()));
EnsureDirectoryExists
(
target
->
GetDirectory
(
this
->
GetConfigName
()));
}
this
->
OSXBundleGenerator
=
new
cmOSXBundleGenerator
(
target
,
...
...
@@ -413,7 +413,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
if
(
target
.
IsAppBundleOnApple
())
{
// Create the app bundle
std
::
string
outpath
=
targe
t
.
GetDirectory
(
cfgName
);
std
::
string
outpath
=
g
t
.
GetDirectory
(
cfgName
);
this
->
OSXBundleGenerator
->
CreateAppBundle
(
this
->
TargetNameOut
,
outpath
);
// Calculate the output path
...
...
@@ -430,13 +430,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
{
// Create the library framework.
this
->
OSXBundleGenerator
->
CreateFramework
(
this
->
TargetNameOut
,
targe
t
.
GetDirectory
(
cfgName
));
g
t
.
GetDirectory
(
cfgName
));
}
else
if
(
target
.
IsCFBundleOnApple
())
{
// Create the core foundation bundle.
this
->
OSXBundleGenerator
->
CreateCFBundle
(
this
->
TargetNameOut
,
targe
t
.
GetDirectory
(
cfgName
));
g
t
.
GetDirectory
(
cfgName
));
}
// Write comments.
...
...
Source/cmNinjaTargetGenerator.cxx
View file @
8b016886
...
...
@@ -254,7 +254,7 @@ cmNinjaTargetGenerator
std
::
string
cmNinjaTargetGenerator
::
GetTargetOutputDir
()
const
{
std
::
string
dir
=
this
->
Target
->
GetDirectory
(
this
->
GetConfigName
());
std
::
string
dir
=
this
->
Generator
Target
->
GetDirectory
(
this
->
GetConfigName
());
return
ConvertToNinjaPath
(
dir
);
}
...
...
Source/cmTarget.cxx
View file @
8b016886
...
...
@@ -1770,25 +1770,6 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(
return
&
i
->
second
;
}
//----------------------------------------------------------------------------
std
::
string
cmTarget
::
GetDirectory
(
const
std
::
string
&
config
,
bool
implib
)
const
{
if
(
this
->
IsImported
())
{
// Return the directory from which the target is imported.
return
cmSystemTools
::
GetFilenamePath
(
this
->
ImportedGetFullPath
(
config
,
implib
));
}
else
if
(
OutputInfo
const
*
info
=
this
->
GetOutputInfo
(
config
))
{
// Return the directory in which the target will be built.
return
implib
?
info
->
ImpDir
:
info
->
OutDir
;
}
return
""
;
}
//----------------------------------------------------------------------------
std
::
string
cmTarget
::
GetPDBDirectory
(
const
std
::
string
&
config
)
const
{
...
...
Source/cmTarget.h
View file @
8b016886
...
...
@@ -231,13 +231,6 @@ public:
the link dependencies of this target. */
std
::
string
CheckCMP0004
(
std
::
string
const
&
item
)
const
;
/** Get the directory in which this target will be built. If the
configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
output directory is given. */
std
::
string
GetDirectory
(
const
std
::
string
&
config
=
""
,
bool
implib
=
false
)
const
;
/** Get the directory in which this targets .pdb files will be placed.
If the configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
...
...
Source/cmVisualStudio10TargetGenerator.cxx
View file @
8b016886
...
...
@@ -1780,7 +1780,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
}
else
{
outDir
=
this
->
Target
->
GetDirectory
(
config
->
c_str
())
+
"/"
;
outDir
=
this
->
Generator
Target
->
GetDirectory
(
config
->
c_str
())
+
"/"
;
targetNameFull
=
this
->
GeneratorTarget
->
GetFullName
(
config
->
c_str
());
}
this
->
ConvertToWindowsSlash
(
intermediateDir
);
...
...
@@ -2584,7 +2584,8 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
std
::
string
pdb
=
this
->
Target
->
GetPDBDirectory
(
config
.
c_str
());
pdb
+=
"/"
;
pdb
+=
targetNamePDB
;
std
::
string
imLib
=
this
->
Target
->
GetDirectory
(
config
.
c_str
(),
true
);
std
::
string
imLib
=
this
->
GeneratorTarget
->
GetDirectory
(
config
.
c_str
(),
true
);
imLib
+=
"/"
;
imLib
+=
targetNameImport
;
...
...
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