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

Daniel Schepler dschepler at scalable-networks.com
Mon Oct 27 20:14:24 EDT 2014


I think this should work:

$<$<NOT:$<CONFIG:Debug>>:${my_release_libs}>
-- 
Daniel

-----Original Message-----
From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Robert Dailey
Sent: Monday, October 27, 2014 5:12 PM
To: CMake
Subject: Re: [CMake] Refer to all debug or release targets with generator expressions

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?
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake



More information about the CMake mailing list