[CMake] CMakeCache parse errors from line breaks

Zbyněk Novotný mr.clayman at seznam.cz
Wed Jan 18 04:13:38 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.

I've found two ways to get around this problem so far -- either I call my "find_package" script with the "quiet" argument, but then I won't know if the process succeeded, or I can manually edit the cache file and put all three values on the same line. That change, of course, won't live past the next cache file recreation.

So, if anyone knows a way that will fix this problem, I'll be most grateful to hear about it.

Thanks very much in advance for all tips and comments.

Cheers, Zbynek


More information about the CMake mailing list