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

Function cmEnableLanguageCommand

Source/cmEnableLanguageCommand.cxx:11–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#include "cmSystemTools.h"
10
11bool cmEnableLanguageCommand(std::vector<std::string> const& args,
12 cmExecutionStatus& status)
13{
14 if (args.empty()) {
15 status.SetError("called with incorrect number of arguments");
16 return false;
17 }
18
19 cmMakefile& mf = status.GetMakefile();
20 if (!mf.IsNormalDefinitionSet("PROJECT_NAME")) {
21 switch (mf.GetPolicyStatus(cmPolicies::CMP0165)) {
22 case cmPolicies::WARN:
23 mf.IssueMessage(
24 MessageType::AUTHOR_WARNING,
25 "project() should be called prior to this enable_language() call.");
26 break;
27 case cmPolicies::OLD:
28 break;
29 case cmPolicies::NEW:
30 mf.IssueMessage(
31 MessageType::FATAL_ERROR,
32 "project() must be called prior to this enable_language() call.");
33 cmSystemTools::SetFatalErrorOccurred();
34 return false;
35 default:
36 break;
37 }
38 }
39
40 bool optional = false;
41 std::vector<std::string> languages;
42 for (std::string const& it : args) {
43 if (it == "OPTIONAL") {
44 optional = true;
45 } else {
46 languages.push_back(it);
47 }
48 }
49
50 mf.EnableLanguage(languages, optional);
51 return true;
52}

Callers

nothing calls this directly

Calls 8

IsNormalDefinitionSetMethod · 0.80
push_backMethod · 0.80
emptyMethod · 0.45
SetErrorMethod · 0.45
GetMakefileMethod · 0.45
GetPolicyStatusMethod · 0.45
IssueMessageMethod · 0.45
EnableLanguageMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…