Merge topic 'filter-showincludes-in-launcher'

e5e3f3d CTest: filter /showIncludes output from ninja compile launcher
This commit is contained in:
Brad King 2013-12-03 09:48:09 -05:00 committed by CMake Topic Stage
commit 07528f78d7
5 changed files with 46 additions and 4 deletions

View File

@ -46,9 +46,31 @@ if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
endif()
if(CTEST_USE_LAUNCHERS)
set(CTEST_LAUNCH_COMPILE "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR> --output <OBJECT> --source <SOURCE> --language <LANGUAGE> --")
set(CTEST_LAUNCH_LINK "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR> --output <TARGET> --target-type <TARGET_TYPE> --language <LANGUAGE> --")
set(CTEST_LAUNCH_CUSTOM "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR> --output <OUTPUT> --")
set(__launch_common_options
"--target-name <TARGET_NAME> --build-dir <CMAKE_CURRENT_BINARY_DIR>")
set(__launch_compile_options
"${__launch_common_options} --output <OBJECT> --source <SOURCE> --language <LANGUAGE>")
set(__launch_link_options
"${__launch_common_options} --output <TARGET> --target-type <TARGET_TYPE> --language <LANGUAGE>")
set(__launch_custom_options
"${__launch_common_options} --output <OUTPUT>")
if("${CMAKE_GENERATOR}" MATCHES "Ninja")
set(__launch_compile_options "${__launch_compile_options} --filter-prefix <CMAKE_CL_SHOWINCLUDES_PREFIX>")
endif()
set(CTEST_LAUNCH_COMPILE
"\"${CMAKE_CTEST_COMMAND}\" --launch ${__launch_compile_options} --")
set(CTEST_LAUNCH_LINK
"\"${CMAKE_CTEST_COMMAND}\" --launch ${__launch_link_options} --")
set(CTEST_LAUNCH_CUSTOM
"\"${CMAKE_CTEST_COMMAND}\" --launch ${__launch_custom_options} --")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CTEST_LAUNCH_COMPILE}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CTEST_LAUNCH_LINK}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_CUSTOM "${CTEST_LAUNCH_CUSTOM}")

View File

@ -64,7 +64,8 @@ bool cmCTestLaunch::ParseArguments(int argc, const char* const* argv)
DoingTargetName,
DoingTargetType,
DoingBuildDir,
DoingCount };
DoingCount,
DoingFilterPrefix };
Doing doing = DoingNone;
int arg0 = 0;
for(int i=1; !arg0 && i < argc; ++i)
@ -98,6 +99,10 @@ bool cmCTestLaunch::ParseArguments(int argc, const char* const* argv)
{
doing = DoingBuildDir;
}
else if(strcmp(arg, "--filter-prefix") == 0)
{
doing = DoingFilterPrefix;
}
else if(doing == DoingOutput)
{
this->OptionOutput = arg;
@ -132,6 +137,11 @@ bool cmCTestLaunch::ParseArguments(int argc, const char* const* argv)
this->OptionBuildDir = arg;
doing = DoingNone;
}
else if(doing == DoingFilterPrefix)
{
this->OptionFilterPrefix = arg;
doing = DoingNone;
}
}
// Extract the real command line.
@ -573,8 +583,15 @@ void cmCTestLaunch::DumpFileToXML(std::ostream& fxml,
std::string line;
const char* sep = "";
while(cmSystemTools::GetLineFromStream(fin, line))
{
if(OptionFilterPrefix.size() && cmSystemTools::StringStartsWith(
line.c_str(), OptionFilterPrefix.c_str()))
{
continue;
}
fxml << sep << cmXMLSafe(line).Quotes(false);
sep = "\n";
}

View File

@ -45,6 +45,7 @@ private:
std::string OptionTargetName;
std::string OptionTargetType;
std::string OptionBuildDir;
std::string OptionFilterPrefix;
bool ParseArguments(int argc, const char* const* argv);
// The real command line appearing after launcher arguments.

View File

@ -807,6 +807,7 @@ static const char* ruleReplaceVars[] =
"CMAKE_CURRENT_BINARY_DIR",
"CMAKE_RANLIB",
"CMAKE_LINKER",
"CMAKE_CL_SHOWINCLUDES_PREFIX",
0
};

View File

@ -266,6 +266,7 @@ public:
const char* Defines;
const char* RuleLauncher;
const char* DependencyFile;
const char* FilterPrefix;
};
/** Set whether to treat conversions to SHELL as a link script shell. */