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

Verweij, Arjen VerweijA at tass-safe.com
Wed Feb 9 11:24:28 EST 2011


Hi,

I'm looking for a way to parse information from source files and feed the outcome as input to the build process.

In more detail, I have Fortran files that contain information about what optimization flags should be fed to the compiler.

Currently there is a python script that does preprocessing of all source, stores information in override.cmake files using set_source_file_properties(). This works fine, but makes maintaining source more error prone than it was. For instance a developer might use the code for an FE element, use it as the basis for a collapsed version and inherit specific optimizations which are now ignored.

I have looked at a way to chain this step using add_custom_command(), but I see no possibility to tell the generator about some variable an external program will fill in during the build phase.

Do Fortran developers have to learn to live with this, or is there a way to sneak information from source file into the makefile generation?

Thanks,
Arjen


More information about the CMake mailing list