[CMake] read file content to a variable at build-time

Rothbauer, Stefan stefan.rothbauer at siemens.com
Thu Aug 1 10:07:31 EDT 2013


Hello,

I set up cmake to use a external project. This 3rd party library writes out a file which contains all include paths set by this library. For the master cmake project I need to read this information at build time into a cmake variable to set the include directories correctly.
Is there a way to do this?
I checked into External_Project_Add_Step but couldn´t find a solution.
I can´t use FILE(READ.) either since the file with include paths is generated when cmake configures the 3rd party library.
Execute_Process (cat .) can´t be used because the context switch destroys the information.

Thanks for any hints!

Best regards,

Stefan


More information about the CMake mailing list