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
CMake
CMake
Commits
f4ff60a8
Commit
f4ff60a8
authored
Sep 05, 2018
by
Vitaly Stakhovsky
Committed by
Brad King
Sep 18, 2018
Browse files
cmMakefile: Make GetSafeDefinition return std::string const&
parent
42212f75
Changes
25
Hide whitespace changes
Inline
Side-by-side
Source/CTest/cmCTestHandlerCommand.cxx
View file @
f4ff60a8
...
...
@@ -151,9 +151,9 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
cmSystemTools
::
CollapseFullPath
(
this
->
Values
[
ct_BUILD
]).
c_str
(),
this
->
Quiet
);
}
else
{
const
char
*
bdir
=
std
::
string
const
&
bdir
=
this
->
Makefile
->
GetSafeDefinition
(
"CTEST_BINARY_DIRECTORY"
);
if
(
bdir
)
{
if
(
!
bdir
.
empty
()
)
{
this
->
CTest
->
SetCTestConfiguration
(
"BuildDirectory"
,
cmSystemTools
::
CollapseFullPath
(
bdir
).
c_str
(),
this
->
Quiet
);
...
...
Source/cmComputeLinkInformation.cxx
View file @
f4ff60a8
...
...
@@ -1725,7 +1725,7 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
}
const
char
*
stagePath
=
this
->
Makefile
->
GetDefinition
(
"CMAKE_STAGING_PREFIX"
);
const
char
*
installPrefix
=
std
::
string
const
&
installPrefix
=
this
->
Makefile
->
GetSafeDefinition
(
"CMAKE_INSTALL_PREFIX"
);
cmSystemTools
::
ConvertToUnixSlashes
(
rootPath
);
std
::
vector
<
std
::
string
>
const
&
rdirs
=
this
->
GetRuntimeSearchPath
();
...
...
Source/cmDepends.cxx
View file @
f4ff60a8
...
...
@@ -36,7 +36,7 @@ bool cmDepends::Write(std::ostream& makeDepends, std::ostream& internalDepends)
std
::
string
srcLang
=
"CMAKE_DEPENDS_CHECK_"
;
srcLang
+=
this
->
Language
;
cmMakefile
*
mf
=
this
->
LocalGenerator
->
GetMakefile
();
const
char
*
srcStr
=
mf
->
GetSafeDefinition
(
srcLang
);
std
::
string
const
&
srcStr
=
mf
->
GetSafeDefinition
(
srcLang
);
std
::
vector
<
std
::
string
>
pairs
;
cmSystemTools
::
ExpandListArgument
(
srcStr
,
pairs
);
...
...
Source/cmExportFileGenerator.cxx
View file @
f4ff60a8
...
...
@@ -195,7 +195,7 @@ static bool checkInterfaceDirs(const std::string& prepro,
cmGeneratorTarget
*
target
,
const
std
::
string
&
prop
)
{
const
char
*
installDir
=
std
::
string
const
&
installDir
=
target
->
Makefile
->
GetSafeDefinition
(
"CMAKE_INSTALL_PREFIX"
);
std
::
string
const
&
topSourceDir
=
target
->
GetLocalGenerator
()
->
GetSourceDirectory
();
...
...
Source/cmExtraCodeBlocksGenerator.cxx
View file @
f4ff60a8
...
...
@@ -666,7 +666,7 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
pureFortran
=
true
;
}
std
::
string
compilerId
=
mf
->
GetSafeDefinition
(
compilerIdVar
);
std
::
string
const
&
compilerId
=
mf
->
GetSafeDefinition
(
compilerIdVar
);
std
::
string
compiler
=
"gcc"
;
// default to gcc
if
(
compilerId
==
"MSVC"
)
{
if
(
mf
->
IsDefinitionSet
(
"MSVC10"
))
{
...
...
Source/cmExtraCodeLiteGenerator.cxx
View file @
f4ff60a8
...
...
@@ -599,7 +599,7 @@ std::string cmExtraCodeLiteGenerator::GetCodeLiteCompilerName(
compilerIdVar
=
"CMAKE_C_COMPILER_ID"
;
}
std
::
string
compilerId
=
mf
->
GetSafeDefinition
(
compilerIdVar
);
std
::
string
const
&
compilerId
=
mf
->
GetSafeDefinition
(
compilerIdVar
);
std
::
string
compiler
=
"gnu g++"
;
// default to g++
// Since we need the compiler for parsing purposes only
...
...
Source/cmGeneratorExpressionNode.cxx
View file @
f4ff60a8
...
...
@@ -580,10 +580,11 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
cmGeneratorExpressionDAGChecker
*
/*unused*/
,
const
std
::
string
&
lang
)
const
{
const
char
*
compilerId
=
context
->
LG
->
GetMakefile
()
->
GetSafeDefinition
(
"CMAKE_"
+
lang
+
"_COMPILER_ID"
);
std
::
string
const
&
compilerId
=
context
->
LG
->
GetMakefile
()
->
GetSafeDefinition
(
"CMAKE_"
+
lang
+
"_COMPILER_ID"
);
if
(
parameters
.
empty
())
{
return
compilerId
?
compilerId
:
""
;
return
compilerId
;
}
static
cmsys
::
RegularExpression
compilerIdValidator
(
"^[A-Za-z0-9_]*$"
);
if
(
!
compilerIdValidator
.
find
(
*
parameters
.
begin
()))
{
...
...
@@ -591,15 +592,16 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
"Expression syntax not recognized."
);
return
std
::
string
();
}
if
(
!
compilerId
)
{
if
(
compilerId
.
empty
()
)
{
return
parameters
.
front
().
empty
()
?
"1"
:
"0"
;
}
if
(
strcmp
(
parameters
.
begin
()
->
c_str
(),
compilerId
)
==
0
)
{
if
(
strcmp
(
parameters
.
begin
()
->
c_str
(),
compilerId
.
c_str
()
)
==
0
)
{
return
"1"
;
}
if
(
cmsysString_strcasecmp
(
parameters
.
begin
()
->
c_str
(),
compilerId
)
==
0
)
{
if
(
cmsysString_strcasecmp
(
parameters
.
begin
()
->
c_str
(),
compilerId
.
c_str
())
==
0
)
{
switch
(
context
->
LG
->
GetPolicyStatus
(
cmPolicies
::
CMP0044
))
{
case
cmPolicies
::
WARN
:
{
std
::
ostringstream
e
;
...
...
@@ -676,11 +678,11 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode
cmGeneratorExpressionDAGChecker
*
/*unused*/
,
const
std
::
string
&
lang
)
const
{
const
char
*
compilerVersion
=
std
::
string
const
&
compilerVersion
=
context
->
LG
->
GetMakefile
()
->
GetSafeDefinition
(
"CMAKE_"
+
lang
+
"_COMPILER_VERSION"
);
if
(
parameters
.
empty
())
{
return
compilerVersion
?
compilerVersion
:
""
;
return
compilerVersion
;
}
static
cmsys
::
RegularExpression
compilerIdValidator
(
"^[0-9
\\
.]*$"
);
...
...
@@ -689,13 +691,13 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode
"Expression syntax not recognized."
);
return
std
::
string
();
}
if
(
!
compilerVersion
)
{
if
(
compilerVersion
.
empty
()
)
{
return
parameters
.
front
().
empty
()
?
"1"
:
"0"
;
}
return
cmSystemTools
::
VersionCompare
(
cmSystemTools
::
OP_EQUAL
,
parameters
.
begin
()
->
c_str
(),
compilerVersion
)
compilerVersion
.
c_str
()
)
?
"1"
:
"0"
;
}
...
...
@@ -757,17 +759,17 @@ struct PlatformIdNode : public cmGeneratorExpressionNode
const
GeneratorExpressionContent
*
/*content*/
,
cmGeneratorExpressionDAGChecker
*
/*dagChecker*/
)
const
override
{
const
char
*
platformId
=
std
::
string
const
&
platformId
=
context
->
LG
->
GetMakefile
()
->
GetSafeDefinition
(
"CMAKE_SYSTEM_NAME"
);
if
(
parameters
.
empty
())
{
return
platformId
?
platformId
:
""
;
return
platformId
;
}
if
(
!
platformId
)
{
if
(
platformId
.
empty
()
)
{
return
parameters
.
front
().
empty
()
?
"1"
:
"0"
;
}
if
(
strcmp
(
parameters
.
begin
()
->
c_str
(),
platformId
)
==
0
)
{
if
(
*
parameters
.
begin
()
==
platformId
)
{
return
"1"
;
}
return
"0"
;
...
...
Source/cmGeneratorTarget.cxx
View file @
f4ff60a8
...
...
@@ -138,8 +138,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
this
->
SourceEntries
,
true
);
this
->
DLLPlatform
=
strcmp
(
this
->
Makefile
->
GetSafeDefinition
(
"CMAKE_IMPORT_LIBRARY_SUFFIX"
),
""
)
!=
0
;
!
this
->
Makefile
->
GetSafeDefinition
(
"CMAKE_IMPORT_LIBRARY_SUFFIX"
).
empty
();
this
->
PolicyMap
=
t
->
PolicyMap
;
}
...
...
@@ -3489,12 +3488,13 @@ void cmGeneratorTarget::GetFullNameInternal(
}
// if there is no prefix on the target use the cmake definition
std
::
string
targetPrefix2
,
targetSuffix2
;
if
(
!
targetPrefix
&&
prefixVar
)
{
targetPrefix
=
this
->
Makefile
->
GetSafeDefinition
(
prefixVar
);
targetPrefix
2
=
this
->
Makefile
->
GetSafeDefinition
(
prefixVar
);
}
// if there is no suffix on the target use the cmake definition
if
(
!
targetSuffix
&&
suffixVar
)
{
targetSuffix
=
this
->
Makefile
->
GetSafeDefinition
(
suffixVar
);
targetSuffix
2
=
this
->
Makefile
->
GetSafeDefinition
(
suffixVar
);
}
// frameworks have directory prefix but no suffix
...
...
@@ -3502,19 +3502,19 @@ void cmGeneratorTarget::GetFullNameInternal(
if
(
this
->
IsFrameworkOnApple
())
{
fw_prefix
=
this
->
GetFrameworkDirectory
(
config
,
ContentLevel
);
fw_prefix
+=
"/"
;
targetPrefix
=
fw_prefix
.
c_str
()
;
targetSuffix
=
nullptr
;
targetPrefix
2
=
fw_prefix
;
targetSuffix
2
.
clear
()
;
}
if
(
this
->
IsCFBundleOnApple
())
{
fw_prefix
=
this
->
GetCFBundleDirectory
(
config
,
FullLevel
);
fw_prefix
+=
"/"
;
targetPrefix
=
fw_prefix
.
c_str
()
;
targetSuffix
=
nullptr
;
targetPrefix
2
=
fw_prefix
;
targetSuffix
2
.
clear
()
;
}
// Begin the final name with the prefix.
outPrefix
=
targetPrefix
?
targetPrefix
:
""
;
outPrefix
=
targetPrefix
2
;
// Append the target name or property-specified name.
outBase
+=
this
->
GetOutputName
(
config
,
artifact
);
...
...
@@ -3533,7 +3533,7 @@ void cmGeneratorTarget::GetFullNameInternal(
}
// Append the suffix.
outSuffix
=
targetSuffix
?
targetSuffix
:
""
;
outSuffix
=
targetSuffix
2
;
}
std
::
string
cmGeneratorTarget
::
GetLinkerLanguage
(
...
...
Source/cmGetDirectoryPropertyCommand.cxx
View file @
f4ff60a8
...
...
@@ -65,7 +65,7 @@ bool cmGetDirectoryPropertyCommand::InitialPass(
"providing the name of the variable to get."
);
return
false
;
}
std
::
string
output
=
dir
->
GetSafeDefinition
(
*
i
);
std
::
string
const
&
output
=
dir
->
GetSafeDefinition
(
*
i
);
this
->
Makefile
->
AddDefinition
(
variable
,
output
.
c_str
());
return
true
;
}
...
...
Source/cmGlobalGenerator.cxx
View file @
f4ff60a8
...
...
@@ -828,8 +828,9 @@ void cmGlobalGenerator::EnableLanguage(
std
::
string
sharedLibFlagsVar
=
"CMAKE_SHARED_LIBRARY_"
;
sharedLibFlagsVar
+=
lang
;
sharedLibFlagsVar
+=
"_FLAGS"
;
const
char
*
sharedLibFlags
=
mf
->
GetSafeDefinition
(
sharedLibFlagsVar
);
if
(
sharedLibFlags
)
{
std
::
string
const
&
sharedLibFlags
=
mf
->
GetSafeDefinition
(
sharedLibFlagsVar
);
if
(
!
sharedLibFlags
.
empty
())
{
this
->
LanguageToOriginalSharedLibFlags
[
lang
]
=
sharedLibFlags
;
}
...
...
@@ -1092,7 +1093,7 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l,
{
std
::
string
extensionsVar
=
std
::
string
(
"CMAKE_"
)
+
std
::
string
(
l
)
+
std
::
string
(
"_SOURCE_FILE_EXTENSIONS"
);
std
::
string
exts
=
mf
->
GetSafeDefinition
(
extensionsVar
);
const
std
::
string
&
exts
=
mf
->
GetSafeDefinition
(
extensionsVar
);
std
::
vector
<
std
::
string
>
extensionList
;
cmSystemTools
::
ExpandListArgument
(
exts
,
extensionList
);
for
(
std
::
string
const
&
i
:
extensionList
)
{
...
...
@@ -1112,7 +1113,7 @@ bool cmGlobalGenerator::GlobalSettingIsOn(std::string const& name) const
return
this
->
Makefiles
[
0
]
->
IsOn
(
name
);
}
const
char
*
cmGlobalGenerator
::
GetSafeGlobalSetting
(
std
::
string
cmGlobalGenerator
::
GetSafeGlobalSetting
(
std
::
string
const
&
name
)
const
{
assert
(
!
this
->
Makefiles
.
empty
());
...
...
@@ -1593,7 +1594,7 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
for
(
std
::
string
const
&
li
:
langs
)
{
std
::
string
const
standardIncludesVar
=
"CMAKE_"
+
li
+
"_STANDARD_INCLUDE_DIRECTORIES"
;
std
::
string
const
standardIncludesStr
=
std
::
string
const
&
standardIncludesStr
=
mf
->
GetSafeDefinition
(
standardIncludesVar
);
std
::
vector
<
std
::
string
>
standardIncludesVec
;
cmSystemTools
::
ExpandListArgument
(
standardIncludesStr
,
...
...
Source/cmGlobalGenerator.h
View file @
f4ff60a8
...
...
@@ -230,7 +230,7 @@ public:
const
char
*
GetGlobalSetting
(
std
::
string
const
&
name
)
const
;
bool
GlobalSettingIsOn
(
std
::
string
const
&
name
)
const
;
const
char
*
GetSafeGlobalSetting
(
std
::
string
const
&
name
)
const
;
std
::
string
GetSafeGlobalSetting
(
std
::
string
const
&
name
)
const
;
/** Add a file to the manifest of generated targets for a configuration. */
void
AddToManifest
(
std
::
string
const
&
f
);
...
...
Source/cmGlobalNinjaGenerator.cxx
View file @
f4ff60a8
...
...
@@ -651,13 +651,13 @@ void cmGlobalNinjaGenerator::EnableLanguage(
this
->
ResolveLanguageCompiler
(
l
,
mf
,
optional
);
}
#ifdef _WIN32
if
(
strcmp
(
mf
->
GetSafeDefinition
(
"CMAKE_C_SIMULATE_ID"
)
,
"MSVC"
)
!=
0
&&
strcmp
(
mf
->
GetSafeDefinition
(
"CMAKE_CXX_SIMULATE_ID"
)
,
"MSVC"
)
!=
0
&&
if
((
mf
->
GetSafeDefinition
(
"CMAKE_C_SIMULATE_ID"
)
!=
"MSVC"
)
&&
(
mf
->
GetSafeDefinition
(
"CMAKE_CXX_SIMULATE_ID"
)
!=
"MSVC"
)
&&
(
mf
->
IsOn
(
"CMAKE_COMPILER_IS_MINGW"
)
||
strcmp
(
mf
->
GetSafeDefinition
(
"CMAKE_C_COMPILER_ID"
)
,
"GNU"
)
==
0
||
strcmp
(
mf
->
GetSafeDefinition
(
"CMAKE_CXX_COMPILER_ID"
)
,
"GNU"
)
==
0
||
strcmp
(
mf
->
GetSafeDefinition
(
"CMAKE_C_COMPILER_ID"
)
,
"Clang"
)
==
0
||
strcmp
(
mf
->
GetSafeDefinition
(
"CMAKE_CXX_COMPILER_ID"
)
,
"Clang"
)
==
0
))
{
(
mf
->
GetSafeDefinition
(
"CMAKE_C_COMPILER_ID"
)
==
"GNU"
)
||
(
mf
->
GetSafeDefinition
(
"CMAKE_CXX_COMPILER_ID"
)
==
"GNU"
)
||
(
mf
->
GetSafeDefinition
(
"CMAKE_C_COMPILER_ID"
)
==
"Clang"
)
||
(
mf
->
GetSafeDefinition
(
"CMAKE_CXX_COMPILER_ID"
)
==
"Clang"
)))
{
this
->
UsingGCCOnWindows
=
true
;
}
#endif
...
...
Source/cmInstallCommand.cxx
View file @
f4ff60a8
...
...
@@ -5,7 +5,6 @@
#include
"cmsys/Glob.hxx"
#include
<sstream>
#include
<stddef.h>
#include
<string.h>
#include
<utility>
#include
"cmAlgorithms.h"
...
...
@@ -350,8 +349,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
// Check whether this is a DLL platform.
bool
dll_platform
=
strcmp
(
this
->
Makefile
->
GetSafeDefinition
(
"CMAKE_IMPORT_LIBRARY_SUFFIX"
),
""
)
!=
0
;
!
this
->
Makefile
->
GetSafeDefinition
(
"CMAKE_IMPORT_LIBRARY_SUFFIX"
).
empty
();
for
(
std
::
string
const
&
tgt
:
targetList
.
GetVector
())
{
...
...
Source/cmLocalGenerator.cxx
View file @
f4ff60a8
...
...
@@ -683,7 +683,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
std
::
string
flagVar
=
"CMAKE_INCLUDE_FLAG_"
;
flagVar
+=
lang
;
const
char
*
includeFlag
=
this
->
Makefile
->
GetSafeDefinition
(
flagVar
);
std
::
string
const
&
includeFlag
=
this
->
Makefile
->
GetSafeDefinition
(
flagVar
);
flagVar
=
"CMAKE_INCLUDE_FLAG_SEP_"
;
flagVar
+=
lang
;
const
char
*
sep
=
this
->
Makefile
->
GetDefinition
(
flagVar
);
...
...
@@ -1824,9 +1824,9 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared,
std
::
string
flagsVar
=
"CMAKE_SHARED_LIBRARY_"
;
flagsVar
+=
lang
;
flagsVar
+=
"_FLAGS"
;
const
char
*
flags
=
this
->
Makefile
->
GetSafeDefinition
(
flagsVar
);
std
::
string
const
&
flags
=
this
->
Makefile
->
GetSafeDefinition
(
flagsVar
);
if
(
flags
&&
flags
!=
originalFlags
)
{
if
(
!
flags
.
empty
()
&&
flags
!=
originalFlags
)
{
switch
(
this
->
GetPolicyStatus
(
cmPolicies
::
CMP0018
))
{
case
cmPolicies
::
WARN
:
{
std
::
ostringstream
e
;
...
...
@@ -1859,7 +1859,7 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
std
::
string
const
&
lang
,
int
targetType
)
{
const
char
*
picFlags
=
nullptr
;
std
::
string
picFlags
;
if
(
targetType
==
cmStateEnums
::
EXECUTABLE
)
{
std
::
string
flagsVar
=
"CMAKE_"
;
...
...
@@ -1867,13 +1867,13 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
flagsVar
+=
"_COMPILE_OPTIONS_PIE"
;
picFlags
=
this
->
Makefile
->
GetSafeDefinition
(
flagsVar
);
}
if
(
!
picFlags
)
{
if
(
picFlags
.
empty
()
)
{
std
::
string
flagsVar
=
"CMAKE_"
;
flagsVar
+=
lang
;
flagsVar
+=
"_COMPILE_OPTIONS_PIC"
;
picFlags
=
this
->
Makefile
->
GetSafeDefinition
(
flagsVar
);
}
if
(
picFlags
)
{
if
(
!
picFlags
.
empty
()
)
{
std
::
vector
<
std
::
string
>
options
;
cmSystemTools
::
ExpandListArgument
(
picFlags
,
options
);
for
(
std
::
string
const
&
o
:
options
)
{
...
...
Source/cmLocalUnixMakefileGenerator3.cxx
View file @
f4ff60a8
...
...
@@ -1422,7 +1422,8 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
this
->
WriteDisclaimer
(
internalRuleFileStream
);
// for each language we need to scan, scan it
const
char
*
langStr
=
mf
->
GetSafeDefinition
(
"CMAKE_DEPENDS_LANGUAGES"
);
std
::
string
const
&
langStr
=
mf
->
GetSafeDefinition
(
"CMAKE_DEPENDS_LANGUAGES"
);
std
::
vector
<
std
::
string
>
langs
;
cmSystemTools
::
ExpandListArgument
(
langStr
,
langs
);
for
(
std
::
string
const
&
lang
:
langs
)
{
...
...
Source/cmLocalVisualStudio7Generator.cxx
View file @
f4ff60a8
...
...
@@ -1082,7 +1082,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
// Use the NOINHERIT macro to avoid getting VS project default
// libraries which may be set by the user to something bad.
fout
<<
"
\t\t\t\t
AdditionalDependencies=
\"
$(NOINHERIT) "
<<
this
->
Makefile
->
GetSafeDefinition
(
standardLibsVar
.
c_str
()
);
<<
this
->
Makefile
->
GetSafeDefinition
(
standardLibsVar
);
if
(
this
->
FortranProject
)
{
this
->
Internal
->
OutputObjects
(
fout
,
target
,
configName
,
" "
);
}
...
...
@@ -1167,7 +1167,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
// Use the NOINHERIT macro to avoid getting VS project default
// libraries which may be set by the user to something bad.
fout
<<
"
\t\t\t\t
AdditionalDependencies=
\"
$(NOINHERIT) "
<<
this
->
Makefile
->
GetSafeDefinition
(
standardLibsVar
.
c_str
()
);
<<
this
->
Makefile
->
GetSafeDefinition
(
standardLibsVar
);
if
(
this
->
FortranProject
)
{
this
->
Internal
->
OutputObjects
(
fout
,
target
,
configName
,
" "
);
}
...
...
Source/cmMakefile.cxx
View file @
f4ff60a8
...
...
@@ -2384,7 +2384,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
return
def
!=
nullptr
;
}
const
char
*
cmMakefile
::
GetDef
inition
(
const
std
::
string
&
name
)
const
const
std
::
string
*
cmMakefile
::
GetDef
(
const
std
::
string
&
name
)
const
{
const
std
::
string
*
def
=
this
->
StateSnapshot
.
GetDefinition
(
name
);
if
(
!
def
)
{
...
...
@@ -2410,16 +2410,26 @@ const char* cmMakefile::GetDefinition(const std::string& name) const
}
}
#endif
return
(
def
?
def
->
c_str
()
:
nullptr
)
;
return
def
;
}
const
char
*
cmMakefile
::
Get
Safe
Definition
(
const
std
::
string
&
def
)
const
const
char
*
cmMakefile
::
GetDefinition
(
const
std
::
string
&
name
)
const
{
const
char
*
ret
=
this
->
GetDefinition
(
def
);
if
(
!
ret
)
{
return
""
;
const
std
::
string
*
def
=
GetDef
(
name
);
if
(
!
def
)
{
return
nullptr
;
}
return
ret
;
return
def
->
c_str
();
}
const
std
::
string
&
cmMakefile
::
GetSafeDefinition
(
const
std
::
string
&
name
)
const
{
static
std
::
string
const
empty
;
const
std
::
string
*
def
=
GetDef
(
name
);
if
(
!
def
)
{
return
empty
;
}
return
*
def
;
}
std
::
vector
<
std
::
string
>
cmMakefile
::
GetDefinitions
()
const
...
...
Source/cmMakefile.h
View file @
f4ff60a8
...
...
@@ -422,7 +422,8 @@ public:
* cache is then queried.
*/
const
char
*
GetDefinition
(
const
std
::
string
&
)
const
;
const
char
*
GetSafeDefinition
(
const
std
::
string
&
)
const
;
const
std
::
string
*
GetDef
(
const
std
::
string
&
)
const
;
const
std
::
string
&
GetSafeDefinition
(
const
std
::
string
&
)
const
;
std
::
string
GetRequiredDefinition
(
const
std
::
string
&
name
)
const
;
bool
IsDefinitionSet
(
const
std
::
string
&
)
const
;
/**
...
...
Source/cmNinjaTargetGenerator.cxx
View file @
f4ff60a8
...
...
@@ -10,7 +10,6 @@
#include
<map>
#include
<memory>
// IWYU pragma: keep
#include
<sstream>
#include
<string.h>
#include
"cmAlgorithms.h"
#include
"cmComputeLinkInformation.h"
...
...
@@ -174,9 +173,8 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags,
bool
cmNinjaTargetGenerator
::
NeedDepTypeMSVC
(
const
std
::
string
&
lang
)
const
{
return
strcmp
(
this
->
GetMakefile
()
->
GetSafeDefinition
(
"CMAKE_NINJA_DEPTYPE_"
+
lang
),
"msvc"
)
==
0
;
return
(
this
->
GetMakefile
()
->
GetSafeDefinition
(
"CMAKE_NINJA_DEPTYPE_"
+
lang
)
==
"msvc"
);
}
// TODO: Refactor with
...
...
Source/cmPolicies.cxx
View file @
f4ff60a8
...
...
@@ -135,7 +135,7 @@ static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy,
cmPolicies
::
PolicyStatus
*
defaultSetting
)
{
std
::
string
defaultVar
=
"CMAKE_POLICY_DEFAULT_"
+
policy
;
std
::
string
defaultValue
=
mf
->
GetSafeDefinition
(
defaultVar
);
std
::
string
const
&
defaultValue
=
mf
->
GetSafeDefinition
(
defaultVar
);
if
(
defaultValue
==
"NEW"
)
{
*
defaultSetting
=
cmPolicies
::
NEW
;
}
else
if
(
defaultValue
==
"OLD"
)
{
...
...
Prev
1
2
Next
Brad King
@brad.king
mentioned in commit
a8f628c0
·
Sep 18, 2018
mentioned in commit
a8f628c0
mentioned in commit a8f628c0a456f74680bfdad0050f2614dbe50853
Toggle commit list
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