Merge topic 'cmake-build-ninja-verbose'

d1082448 Tests: Extend RunCMake.CommandLine to cover 'cmake --build' for 'ninja -v'
ce935ebe cmake: Teach --build to honor CMAKE_VERBOSE_MAKEFILE for Ninja
This commit is contained in:
Brad King
2015-02-27 10:34:36 -05:00
committed by CMake Topic Stage
20 changed files with 57 additions and 22 deletions
+1 -1
View File
@@ -664,7 +664,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
globalGenerator->GenerateBuildCommand(buildCommand, cmakeMakeProgram,
installProjectName, installDirectory,
globalGenerator->GetPreinstallTargetName(),
buildConfig, false);
buildConfig, false, false);
std::string buildCommandStr =
cmSystemTools::PrintSingleCommand(buildCommand);
cmCPackLogger(cmCPackLog::LOG_DEBUG,
+1 -1
View File
@@ -310,7 +310,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
output, this->BuildMakeProgram,
config,
!this->BuildNoClean,
false, remainingTime);
false, false, remainingTime);
out << output;
// if the build failed then return
if (retVal)
+6 -5
View File
@@ -1677,14 +1677,14 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir,
mf->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
return this->Build(srcdir,bindir,projectName,
newTarget,
output,"",config,false,fast,
output,"",config,false,fast,false,
this->TryCompileTimeout);
}
void cmGlobalGenerator::GenerateBuildCommand(
std::vector<std::string>& makeCommand, const std::string&,
const std::string&, const std::string&, const std::string&,
const std::string&, bool,
const std::string&, bool, bool,
std::vector<std::string> const&)
{
makeCommand.push_back(
@@ -1697,7 +1697,7 @@ int cmGlobalGenerator::Build(
std::string& output,
const std::string& makeCommandCSTR,
const std::string& config,
bool clean, bool fast,
bool clean, bool fast, bool verbose,
double timeout,
cmSystemTools::OutputOption outputflag,
std::vector<std::string> const& nativeOptions)
@@ -1722,7 +1722,7 @@ int cmGlobalGenerator::Build(
{
std::vector<std::string> cleanCommand;
this->GenerateBuildCommand(cleanCommand, makeCommandCSTR, projectName,
bindir, "clean", config, fast);
bindir, "clean", config, fast, verbose);
output += "\nRun Clean Command:";
output += cmSystemTools::PrintSingleCommand(cleanCommand);
output += "\n";
@@ -1745,7 +1745,8 @@ int cmGlobalGenerator::Build(
// now build
std::vector<std::string> makeCommand;
this->GenerateBuildCommand(makeCommand, makeCommandCSTR, projectName,
bindir, target, config, fast, nativeOptions);
bindir, target, config, fast, verbose,
nativeOptions);
std::string makeCommandStr = cmSystemTools::PrintSingleCommand(makeCommand);
output += "\nRun Build Command:";
output += makeCommandStr;
+3 -2
View File
@@ -134,7 +134,7 @@ public:
const std::string& projectName, const std::string& targetName,
std::string& output,
const std::string& makeProgram, const std::string& config,
bool clean, bool fast,
bool clean, bool fast, bool verbose,
double timeout,
cmSystemTools::OutputOption outputflag=cmSystemTools::OUTPUT_NONE,
std::vector<std::string> const& nativeOptions =
@@ -144,7 +144,8 @@ public:
std::vector<std::string>& makeCommand,
const std::string& makeProgram,
const std::string& projectName, const std::string& projectDir,
const std::string& targetName, const std::string& config, bool fast,
const std::string& targetName, const std::string& config,
bool fast, bool verbose,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
+6
View File
@@ -574,12 +574,18 @@ void cmGlobalNinjaGenerator
const std::string& targetName,
const std::string& /*config*/,
bool /*fast*/,
bool verbose,
std::vector<std::string> const& makeOptions)
{
makeCommand.push_back(
this->SelectMakeProgram(makeProgram)
);
if(verbose)
{
makeCommand.push_back("-v");
}
makeCommand.insert(makeCommand.end(),
makeOptions.begin(), makeOptions.end());
if(!targetName.empty())
+1 -1
View File
@@ -196,7 +196,7 @@ public:
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
bool fast,
bool fast, bool verbose,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
+1 -1
View File
@@ -554,7 +554,7 @@ void cmGlobalUnixMakefileGenerator3
const std::string& /*projectDir*/,
const std::string& targetName,
const std::string& /*config*/,
bool fast,
bool fast, bool /*verbose*/,
std::vector<std::string> const& makeOptions)
{
makeCommand.push_back(
+1 -1
View File
@@ -114,7 +114,7 @@ public:
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
bool fast,
bool fast, bool verbose,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
+2 -2
View File
@@ -459,7 +459,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
bool fast,
bool fast, bool verbose,
std::vector<std::string> const& makeOptions)
{
// Select the caller- or user-preferred make program, else MSBuild.
@@ -507,7 +507,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
// Use devenv to build solutions containing Intel Fortran projects.
cmGlobalVisualStudio7Generator::GenerateBuildCommand(
makeCommand, makeProgram, projectName, projectDir,
targetName, config, fast, makeOptions);
targetName, config, fast, verbose, makeOptions);
return;
}
+1 -1
View File
@@ -41,7 +41,7 @@ public:
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
bool fast,
bool fast, bool verbose,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
+1 -1
View File
@@ -120,7 +120,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
const std::string& /*projectDir*/,
const std::string& targetName,
const std::string& config,
bool /*fast*/,
bool /*fast*/, bool /*verbose*/,
std::vector<std::string> const& makeOptions
)
{
+1 -1
View File
@@ -59,7 +59,7 @@ public:
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
bool fast,
bool fast, bool verbose,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
+1 -1
View File
@@ -191,7 +191,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
const std::string& /*projectDir*/,
const std::string& targetName,
const std::string& config,
bool /*fast*/,
bool /*fast*/, bool /*verbose*/,
std::vector<std::string> const& makeOptions)
{
// Select the caller- or user-preferred make program, else devenv.
+1 -1
View File
@@ -69,7 +69,7 @@ public:
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
bool fast,
bool fast, bool verbose,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
+1 -1
View File
@@ -310,7 +310,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
const std::string& /*projectDir*/,
const std::string& targetName,
const std::string& config,
bool /*fast*/,
bool /*fast*/, bool /*verbose*/,
std::vector<std::string> const& makeOptions)
{
// now build the test
+1 -1
View File
@@ -60,7 +60,7 @@ public:
const std::string& projectDir,
const std::string& targetName,
const std::string& config,
bool fast,
bool fast, bool verbose,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
+6 -1
View File
@@ -2789,11 +2789,16 @@ int cmake::Build(const std::string& dir,
return 1;
}
projName = it.GetValue();
bool verbose = false;
if(it.Find("CMAKE_VERBOSE_MAKEFILE"))
{
verbose = it.GetValueAsBool();
}
return gen->Build("", dir,
projName, target,
output,
"",
config, clean, false, 0,
config, clean, false, verbose, 0,
cmSystemTools::OUTPUT_PASSTHROUGH,
nativeOptions);
}
@@ -0,0 +1 @@
-E echo CustomCommand
+5
View File
@@ -0,0 +1,5 @@
add_custom_command(
OUTPUT output.txt
COMMAND ${CMAKE_COMMAND} -E echo CustomCommand > output.txt
)
add_custom_target(CustomTarget ALL DEPENDS output.txt)
@@ -18,6 +18,22 @@ run_cmake_command(build-no-generator
run_cmake_command(build-bad-generator
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator)
if(RunCMake_GENERATOR STREQUAL "Ninja")
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Build-build)
set(RunCMake_TEST_NO_CLEAN 1)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
set(RunCMake_TEST_OPTIONS -DCMAKE_VERBOSE_MAKEFILE=1)
run_cmake(Build)
unset(RunCMake_TEST_OPTIONS)
run_cmake_command(Build-ninja-v ${CMAKE_COMMAND} --build .)
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
endif()
if(UNIX)
run_cmake_command(E_create_symlink-missing-dir
${CMAKE_COMMAND} -E create_symlink T missing-dir/L