[CMake] feed parsed information from source files into compile process

Verweij, Arjen VerweijA at tass-safe.com
Thu Feb 10 08:11:06 EST 2011


Thanks Tyler,

>-----Original Message-----
>From: Tyler Roscoe [mailto:tyler at cryptio.net]

>You can't use add_custom_command() to drive this because the results of
>any custom commands will only be available at build time. You need stuff
>to happen at CMake configure time.

I noticed. Add_custom_target(foo ALL ... ) results are only processed at make+1 and not immediately :(

>Hence, I would use execute_process() to run your python script at
>configure time. It would deposit its results into a file, which you
>could then include() (or file(READ ...)).

While this does work, it will only function properly if cmake needs to run. If for whatever reason (say a -O2/-O3 omp compiler bug in xlf_r ;) ) you change the in-file compiler flags they will not be picked up until you run cmake.

I'm gonna try a few things, but I'm not too hopeful :P

Regards,
Arjen


More information about the CMake mailing list