MCPcopy Create free account
hub / github.com/Kitware/CMake / CheckDefinition

Method CheckDefinition

Source/cmLocalGenerator.cxx:4759–4794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4757}
4758
4759bool cmLocalGenerator::CheckDefinition(std::string const& define) const
4760{
4761 // Many compilers do not support -DNAME(arg)=sdf so we disable it.
4762 std::string::size_type pos = define.find_first_of("(=");
4763 if (pos != std::string::npos) {
4764 if (define[pos] == '(') {
4765 std::ostringstream e;
4766 /* clang-format off */
4767 e << "WARNING: Function-style preprocessor definitions may not be "
4768 "passed on the compiler command line because many compilers "
4769 "do not support it.\n"
4770 "CMake is dropping a preprocessor definition: " << define << "\n"
4771 "Consider defining the macro in a (configured) header file.\n";
4772 /* clang-format on */
4773 cmSystemTools::Message(e.str());
4774 return false;
4775 }
4776 }
4777
4778 // Many compilers do not support # in the value so we disable it.
4779 if (define.find_first_of('#') != std::string::npos) {
4780 std::ostringstream e;
4781 /* clang-format off */
4782 e << "WARNING: Preprocessor definitions containing '#' may not be "
4783 "passed on the compiler command line because many compilers "
4784 "do not support it.\n"
4785 "CMake is dropping a preprocessor definition: " << define << "\n"
4786 "Consider defining the macro in a (configured) header file.\n";
4787 /* clang-format on */
4788 cmSystemTools::Message(e.str());
4789 return false;
4790 }
4791
4792 // Assume it is supported.
4793 return true;
4794}
4795
4796static void cmLGInfoProp(cmMakefile* mf, cmGeneratorTarget* target,
4797 std::string const& prop)

Callers 1

AppendDefinesMethod · 0.95

Calls 3

MessageClass · 0.85
find_first_ofMethod · 0.80
strMethod · 0.80

Tested by

no test coverage detected