On 3/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
On 3/31/07, Filipe Sousa <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > hi,
> > I am using cmake and some library of boost on a linux box. When I use
> > the boost::shared_ptr, everything is fine. But when I try to
> > #include <boost/filesystem/operations.hpp>
> > #include <boost/filesystem/path.hpp>,
> > the cmake generates lots of "undefined reference to
> > 'boost::filesystem::...' errors. Is there something wrong with the
> > FindBoost.cmake? Why I still can use part of the boost like
> > boost::shared_ptr? Thanks for help.
> > zl2k
>
> most of boost are header files only, but boost filesystem has it's own
> library that you must link against you program. that's why you have
> undefined references.
>
> Filipe Sousa
>
>
>
>
>
> _______________________________________________
> CMake mailing list
> [email protected]
> http://www.cmake.org/mailman/listinfo/cmake
>
>
Could you give me more guidance on how to do that? Do I need to change
the FindBoost.cmake so that let it find the boost/filesystem? Or
should I change the CMakeList.txt? Thanks again.
You don't have to change the module. The comments at the beginning of
the module tells you that 2 variables have been set by the module
itself: ${Boost_INCLUDE_DIRS} and ${Boost_LIBRARY_DIRS}. It means that
the module is in charge to set these 2 variables, and you are the guy
who has to use them:)
Here is an example of CMakeLists.txt t to compile the `simple_ls.cc'
available in the boost filesystem documentation.
--------------------------------------------------
PROJECT(TestBoost)
FIND_PACKAGE(Boost)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
ADD_EXECUTABLE(myls simple_ls.cc)
TARGET_LINK_LIBRARIES(myls boost_filesystem)
--------------------------------------------------
the critical point is, as said Filipe above, the library must be
linked against the program, that is what the `TARGET_LINK_LIBRARIES'
does.
bye
--
Tristan Carel
Music with dinner is an insult both to the cook and the violinist.
http://www.tristan-carel.com
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake