How do I output the result of a generator expression in CMake?

How do I print the result of the evaluated generator expression during configuration?

You cannot. Generator expressions are intended for things, which are not exactly known at configuration stage: they depend on build type, which, in case of multiconfiguration generators, becomes known only at the build stage.

You may, however, save a value of the generator expression into the file, but the file will be written only at the end of the configuration stage:

file(GENERATE OUTPUT <filename> CONTENT <string-with-generator-expression>)

More detailed description of file(GENERATOR) see in documentation.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)