[CMake] Refer to all debug or release targets with generator expressions

Robert Dailey rcdailey.lists at gmail.com
Mon Oct 27 20:12:10 EDT 2014


I forgot to give a more concrete example. Consider this:

    add_library( Foo INTERFACE )
    target_link_libraries( Foo INTERFACE
        $<$<CONFIG:Debug>:${lib_debug}>
        $<$<CONFIG:Release>:${lib_release}>
        $<$<CONFIG:RelWithDebInfo>:${lib_release}>
        $<$<CONFIG:MinSizeRel>:${lib_release}>
    )

Must I do it like this for each and every configuration?

On Mon, Oct 27, 2014 at 7:10 PM, Robert Dailey <rcdailey.lists at gmail.com> wrote:
> I know that when defining link libraries, I can do this:
>
> $<$<CONFIG:Debug>:${my_debug_libs}>
>
> The debug libraries will be the same for all debug targets. Likewise
> with Release targets. Is there a way to refer to *all* release targets
> using generator expressions? There are 3 release configurations that
> ship with CMake by default for IDEs like Visual Studio. It would be
> redundant for me to specify a generator expression for each and every
> configuration. It'd be simpler to somehow map my release libs to all
> release configurations somehow since they do not differ.
>
> Any ideas on how to do this?


More information about the CMake mailing list