[cmake-developers] Generating information for C++ tools in cmake (patch)
Brad King
brad.king at kitware.com
Mon Apr 4 11:26:45 EDT 2011
On 04/01/2011 02:42 PM, Manuel Klimek wrote:
> sorry for the delay, but I was busy with other stuff - please find
> attached a proposal patch for the test - I don't know enough about the
> cmake testing infrastructure to say whether that was what you
> imagined, please let me know if I should change anything.
That looks pretty good, thanks. Here are a few comments from review:
- The cmSystemTools::ParseArguments method is not very solid. It fails for
double-quotes in the middle of an argument, like '-I"a b"'. Use the newer
ParseUnixCommandLine instead. Unfortunately for historical reasons we
need to convert from vector<std::string> to vector<cmStdString>. Try
the patch below.
- The Source directory should not be touched for this. Put the source code
in Tests/CMakeLib and move the code to build the executable to the
CMakeLists.txt file in that directory.
- In the CompileCommandOutput test source files, please actually create a
symbol in each library and call them from the main. Otherwise some
toolchains will complain about empty object files.
- The ADD_TEST_MACRO call will need to be conditioned to run only when the
exported compile lines will work. I will take care of that for you when
the rest of the patch is ready.
Thanks,
-Brad
diff --git a/Source/run_compile_commands.cxx b/Source/run_compile_commands.cxx
index 0b248f7..82cedfb 100644
--- a/Source/run_compile_commands.cxx
+++ b/Source/run_compile_commands.cxx
@@ -117,8 +117,9 @@ int main ()
it = parser.GetTranslationUnits().begin(),
end = parser.GetTranslationUnits().end(); it != end; ++it)
{
- std::vector<cmStdString> command =
- cmSystemTools::ParseArguments(it->at("command").c_str());
+ std::vector<std::string> command1;
+ cmSystemTools::ParseUnixCommandLine(it->at("command").c_str(), command1);
+ std::vector<cmStdString> command(command1.begin(), command1.end());
if (!cmSystemTools::RunSingleCommand(
command, 0, 0, it->at("directory").c_str()))
{
More information about the cmake-developers
mailing list