Replace temporary bool by inlining warning condition.

This commit is contained in:
Stephen Kelly 2015-01-27 22:13:45 +01:00
parent 6cd2ee9524
commit 11093a03e0
1 changed files with 11 additions and 15 deletions

View File

@ -3641,24 +3641,20 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4()
bool cmLocalGenerator::CheckDefinition(std::string const& define) const bool cmLocalGenerator::CheckDefinition(std::string const& define) const
{ {
// Many compilers do not support -DNAME(arg)=sdf so we disable it. // Many compilers do not support -DNAME(arg)=sdf so we disable it.
bool function_style = false;
std::string::size_type pos = define.find_first_of("(="); std::string::size_type pos = define.find_first_of("(=");
if (pos != std::string::npos) if (pos != std::string::npos)
{ {
function_style = define[pos] == '('; if (define[pos] == '(')
} {
std::ostringstream e;
if(function_style) e << "WARNING: Function-style preprocessor definitions may not be "
{ << "passed on the compiler command line because many compilers "
std::ostringstream e; << "do not support it.\n"
e << "WARNING: Function-style preprocessor definitions may not be " << "CMake is dropping a preprocessor definition: " << define << "\n"
<< "passed on the compiler command line because many compilers " << "Consider defining the macro in a (configured) header file.\n";
<< "do not support it.\n" cmSystemTools::Message(e.str().c_str());
<< "CMake is dropping a preprocessor definition: " << define << "\n" return false;
<< "Consider defining the macro in a (configured) header file.\n"; }
cmSystemTools::Message(e.str().c_str());
return false;
} }
// Many compilers do not support # in the value so we disable it. // Many compilers do not support # in the value so we disable it.