make compile command output optional
This commit is contained in:
parent
fe07b0557b
commit
5674844de4
|
@ -50,6 +50,9 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles")
|
|||
IF(DEFINED CMAKE_RULE_MESSAGES)
|
||||
SET_PROPERTY(GLOBAL PROPERTY RULE_MESSAGES ${CMAKE_RULE_MESSAGES})
|
||||
ENDIF(DEFINED CMAKE_RULE_MESSAGES)
|
||||
SET(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL
|
||||
"Enable/Disable output of compile commands during generation."
|
||||
)
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Makefiles")
|
||||
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ void cmGlobalUnixMakefileGenerator3::AddCXXCompileCommand(
|
|||
{
|
||||
std::string commandDatabaseName =
|
||||
std::string(this->GetCMakeInstance()->GetHomeOutputDirectory())
|
||||
+ "/cxx_commands.json";
|
||||
+ "/compile_commands.json";
|
||||
this->CommandDatabase =
|
||||
new cmGeneratedFileStream(commandDatabaseName.c_str());
|
||||
*this->CommandDatabase << "[" << std::endl;
|
||||
|
|
|
@ -671,7 +671,8 @@ cmMakefileTargetGenerator
|
|||
std::vector<std::string> compileCommands;
|
||||
cmSystemTools::ExpandListArgument(compileRule, compileCommands);
|
||||
|
||||
if (lang_is_c_or_cxx && compileCommands.size() == 1)
|
||||
if (this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS") &&
|
||||
lang_is_c_or_cxx && compileCommands.size() == 1)
|
||||
{
|
||||
std::string compileCommand = compileCommands[0];
|
||||
this->LocalGenerator->ExpandRuleVariables(compileCommand, vars);
|
||||
|
|
Loading…
Reference in New Issue