[CMake] How to query compiler definitions?

SF Markus Elfring elfring at users.sourceforge.net
Thu Jan 20 10:30:25 EST 2011


> Probably that would be pretty difficult to achieve and definitely would
> break backwards-compatibility beyond resurrection.

I have got a different opinion. I imagine that a property with a new name can 
provide the desired service to retrieve target parameters in a portable way from 
the build environment.
Otherwise: Would the addition of a CMake command make more sense for this purpose?


> You shouldn't check for a preprocessor symbol in CMake.

It's just the way I would prefer to adapt the build process to the requirements 
of the source files at the moment.

It seems that the evaluation of compilation parameters (variable 
"CMAKE_CXX_FLAGS...") with regular expressions is an approach that will 
currently work to some degree. The used pattern determines how many compilers 
will be supported.


> Instead, probably do a find_package(TinyXML)

I would appreciate if a corresponding module (search script) will become 
generally available for CMake.


> and then depending on the result offer the user an option variable

I guess that the term "user" needs to be distinguished for its various meanings.

There are some switches involved that might only interest a subset of them.
- software developers
- system integrators
- tool users

Regards,
Markus


More information about the CMake mailing list