[CMake] How to use generated cmake files?

Steve Huston shuston at riverace.com
Mon Mar 9 13:53:41 EDT 2009


Hi Stephan,

>     I'd like to compile a lot of generated C++ source files 
> which are all
> generated at once with a single command.  Since there are issues
with
> using file( GLOB_RECURSE ...) to get a list of these 
> generated files, I
> tried to additionally generate a file called "sourcelist.cmake"
which
> contains a list( APPEND ...) command with a list of all 
> generated files.
> 
>     Now I include() this file from my CMakeLists.txt and it 
> works as expected
> - as long as that sourcelist.cmake file is already there.  If 
> it's not, I'm getting an error "include could not find load file".

Right.

>     How could I set up a dependency which starts my generator 
> in case this include file is not there yet?  I've tried a few
things, 
> looked at the FAQ and googled a bit, but couldn't find anything.
> I'm using CMake 2.6.2 on Linux.

I did something like this by running the generator program from inside
cmake itself - not at build time. I got this hint from others on the
list and it works well. I protected the generator step in my
CMakeLists.txt with a check if the sourcelist.cmake file is older than
the inputs to the generator.

-Steve

--
Steve Huston, Riverace Corporation
Check out my networked programming blog at
http://stevehuston.wordpress.com/



More information about the CMake mailing list