[CMake] CMakeCache parse errors from line breaks

Rolf Eike Beer eike at sf-mail.de
Wed Jan 18 05:00:58 EST 2012


> Hello all,
>
> I'm suffering from the issue described below.
>
> I have created a script designed for use with CMake's find_package
> functionality, essentially following the steps outlined here:
>
> http://www.vtk.org/Wiki/CMake:How_To_Find_Libraries#Writing_find_modules
>
> In my case, I use execute_process to call an external application three
> times in order to obtain various compiler flag values it prints on stdout,
> storing the result of each call in separate variable. So far so good.
>
> The issue arises when I use the find_package_handle_standard_args
> function. In the course of its processing, it calls the
> find_package_message that adds to CMakeCache.txt this internal variable:
>
> FIND_PACKAGE_MESSAGE_DETAILS_Metaserver:INTERNAL=[-I/usr/include
> ][-L/usr/lib -L/usr/lib/metaserver][/usr/lib/metaserver/handlers
> ]
>
> Subsequent processing of the cache file by CMake yields the parsing error
> I've been struggling with.
>
> I'm pretty sure there are no superficial newlines in the output of the app
> I call other than those at the end of each string, but I believe that if
> those were the issue, the second value would have had a line break at its
> end -- just before the closing square bracket -- as well.

execute_process(... OUTPUT_STRIP_TRAILING_WHITESPACE)

HTH&HAND,

Eike


More information about the CMake mailing list