[cmake-developers] Generating information for C++ tools in cmake (patch)

Manuel Klimek klimek at google.com
Mon Apr 4 12:01:54 EDT 2011


On Mon, Apr 4, 2011 at 8:26 AM, Brad King <brad.king at kitware.com> wrote:
> 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.

Done.

> - 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.

Done.

> - 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.

Done.

> - 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.

I also have the previous patches ready (re-based with master). Let me
know how we'll go on about submitting all that.

Thanks,
/Manuel

>
> 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()))
>       {
>



-- 
Manuel Klimek (http://go/klimek)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmake-compile-command-test.patch
Type: text/x-patch
Size: 6412 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20110404/e0356773/attachment-0002.bin>


More information about the cmake-developers mailing list