Yes, target_link_libraries works well, I had problem before because I used find_package(Boost) instead of find_package(Boost COMPONENTS thread), so when I used target_link_libraries( MyProject ${Boost_LIBRARIES} ), it didn't link anything, after I specify the components in find_package, it has no problem.
On Tue, May 1, 2012 at 11:47 AM, Michael Jackson < mike.jack...@bluequartz.net> wrote: > > On May 1, 2012, at 11:37 AM, Mourad Boufarguine wrote: > > > > > On Tue, May 1, 2012 at 9:10 AM, Rolf Eike Beer <e...@sf-mail.de> wrote: > > On Di., 1. Mai. 2012 00:20:58 CEST, Mourad Boufarguine < > mou...@boufarguine.name> wrote: > > > > > Hi, > > > > > > add this : > > > > > > link_directories(${Boost_LIBRARY_DIRS}) > > > > > > after the include_directories command. > > > > No, please don't. The target_link_libraries command is what you really > want. Please stop advertising link_directories, it's usage is almost > certainly wrong and while it sometimes seems to solve your problem it > usually just creates another one. > > > > Eike > > -- > > > > > > > > Unless you disable Boost auto-linking, i'm afraid it's the only option. > Boost autolinking is enabled by default for Visual Studio. In this case, > Boost headers have pragmas to link to Boost libs. > > > > #pragma comment (lib, "libboost_xxxx.lib") > > > > If you don't add Boost_LIBRARY_DIRS to the link directories, it won't > work. > > > > Mourad > > > > Nope. I don't use link_directories at all and I use Boost on windows all > the time. I use the "target_link_libraries(...) method and it has NEVER > give me any trouble on windows with VS 2005, 2008 and 2010. > > YMMV (but it shouldn't) > --- > Mike Jackson www.bluequartz.net > > -- > > 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 > -- Sophie Wang www.sophiehuiwang.com
-- 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