[CMake] Generator expressions for optimized/debug configurations

Robert Dailey rcdailey.lists at gmail.com
Tue Aug 12 21:50:24 EDT 2014


I just installed CMake 3.0 and I'm trying out the new generator
expressions for the target_compile_definitions() command.

I am doing this:

    target_compile_definitions( ${project_name}
        PRIVATE ${general_defs}
        PRIVATE "$<$<CONFIG:debug>:${debug_defs}>"
        PRIVATE "$<$<CONFIG:release>:${release_defs}>"
    )

The problem here is that there are many "release" configurations
provided by CMake by default. I would like a way to target "optimized"
and "unoptimized" configurations, regardless of name.

I'm working on a generic CMake framework (written in CMake language)
that hides away some details of using CMake directly for complex
tasks. As such I can't really know from a generic level which
configurations (by name) will exist. Users could add more or less. The
best I can do from the framework level is target "optimized" or
"unoptimized" configs.

Any way to do this with 3.0?

Thanks in advance.


More information about the CMake mailing list