[CMake] debug, optimized, and custom

Dmytro Ovdiienko dmitriy.ovdienko at gmail.com
Mon Mar 2 15:47:05 EST 2009


Hi,

Suppose, IMPORTED libraries should help. Following is text from CMake
manual:

Higher granularity may be achieved for per-configuration rules by creating
and linking to IMPORTED library targets. See the IMPORTED mode of the
add_library command for more information.

See also http://www.cmake.org/Wiki/CMake_2.6_Notes#Importing_Targets

2009/3/2 <jesseperla at gmail.com>

> For nmake, I think you do it conditional based on the BUILD_TYPE variable.
> But this won't work for visual studio, because this variable isn't
> available. Noone answered my original question about this... Can you repost
> to the mailing list the question?
>
> The only thing I can think of is to have an option(USE_MD) or something,
> where you can generate the libraries differently depending on this option in
> the cache. But I really don't know cmake all that well.
>
>
> On Mar 2, 2009 1:28pm, Dmytro Ovdiienko <dmitriy.ovdienko at gmail.com>
> wrote:
> > All,
> >
> > if I have several configurations (e.g. /MT, /MTd, /MD,
> > /MDd), how can I pass additional libraries to the
> > target_link_libraries? I have two optimized libaries. One for /MT and
> > one for /MD.
> >
> > Thanks,
> > Dima
> >
> > 2009/2/25 jesseperla at gmail.com>
> >
> > On Wed, Feb 25, 2009 at 1:38 AM, Hendrik Sattler post at hendrik-sattler.de>
> wrote:
> > debug and optimized keywords are followed by _one_ library. The help
> entry
> >
> > defines this correctly.
> >
> >
> > Thanks and sorry I missed that in the help. cmake really is amazing, but
> I also find it massive. The "Mastering Cmake" book is excellent, but if
> people write an even longer text with lots of tutorial examples I promise to
> buy it.
> >
> >
> > I have now changed things around to do the following:
> > #Set in my find module.
> > set(ETK_LIBS debug scl-d
> > optimized scl
> > debug libIpopt-mt-d
> > optimized libIpopt-mt) #in reality, there are about 20 libs
> >
> >
> > #set in my cmakelists.txt for my project.
> > add_executable(hello2 ${hello2_SRCS})
> > target_link_libraries(hello2 ${ETK_LIBS })
> >
> > Is this the best way to setup long lists of libraries to link in?
> >
> > And is there any way for me to have separate lists that work for my
> custom build type that works in visual studio? I want an MPI and heavily
> optimized build type that people can choose.
> >
> > _______________________________________________
> >
> > Powered by www.kitware.com
> >
> >
> >
> > Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >
> >
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> >
> >
> >
> > Follow this link to subscribe/unsubscribe:
> >
> > http://www.cmake.org/mailman/listinfo/cmake
> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090302/b9681e1e/attachment.htm>


More information about the CMake mailing list