[CMake] Issues with FindBoost / ${Boost_LIBRARIES}

Arnaud Gelas arnaudgelas at gmail.com
Wed Feb 1 04:35:58 EST 2012


On Wed, Feb 1, 2012 at 4:27 AM, Michael Wild <themiwi at gmail.com> wrote:

> On 02/01/2012 09:33 AM, Arnaud Gelas wrote:
> > Hi all,
> >
> > I have been trying to compile a very simple example with cmake (2.8.5)
> > and boost, and I can't get what I am doing wrong...
> >
> > CMakeLists.txt
> > ----------------------
> >
> > cmake_minimum_required(VERSION 2.6)
> >
> > project(ReadGraph)
> >
> > find_package(Boost 1.46 COMPONENTS graph regex )
> >
> > link_directories(${Boost_LIBRARY_DIRS})
> > include_directories(BEFORE ${Boost_INCLUDE_DIRS})
> >
> > add_executable(ReadGraph ReadGraph.cpp)
> > target_link_libraries(ReadGraph ${Boost_LIBRARIES} )
> > # target_link_libraries(ReadGraph boost_graph boost_regex )
> >
> >
> > ReadGraph.cpp
> > ----------------------
> > //
> http://www.boost.org/doc/libs/1_37_0/libs/graph/doc/read_graphviz.html
> > #include <iostream>
> > #include <string>
> > #include <fstream>
> >
> > #include <boost/graph/adjacency_list.hpp>
> > #include <boost/graph/graphviz.hpp>
> >
> > int main(int , char* [])
> > {
> >   return 0;
> > }
> >
> > Here is what the error I get when trying to compile:
> >
> > $ make
> > /usr/bin/cmake -H/home/ajg23/GITROOT/BGLCMakeQuestion
> > -B/home/ajg23/GITROOT/BGLCMakeQuestion/build --check-build-system
> > CMakeFiles/Makefile.cmake 0
> > /usr/bin/cmake -E cmake_progress_start
> > /home/ajg23/GITROOT/BGLCMakeQuestion/build/CMakeFiles
> > /home/ajg23/GITROOT/BGLCMakeQuestion/build/CMakeFiles/progress.marks
> > make -f CMakeFiles/Makefile2 all
> > make[1]: Entering directory `/home/ajg23/GITROOT/BGLCMakeQuestion/build'
> > make -f CMakeFiles/ReadGraph.dir/build.make
> CMakeFiles/ReadGraph.dir/depend
> > make[2]: Entering directory `/home/ajg23/GITROOT/BGLCMakeQuestion/build'
> > cd /home/ajg23/GITROOT/BGLCMakeQuestion/build && /usr/bin/cmake -E
> > cmake_depends "Unix Makefiles" /home/ajg23/GITROOT/BGLCMakeQuestion
> > /home/ajg23/GITROOT/BGLCMakeQuestion
> > /home/ajg23/GITROOT/BGLCMakeQuestion/build
> > /home/ajg23/GITROOT/BGLCMakeQuestion/build
> >
> /home/ajg23/GITROOT/BGLCMakeQuestion/build/CMakeFiles/ReadGraph.dir/DependInfo.cmake
> > --color=
> > make[2]: Leaving directory `/home/ajg23/GITROOT/BGLCMakeQuestion/build'
> > make -f CMakeFiles/ReadGraph.dir/build.make
> CMakeFiles/ReadGraph.dir/build
> > make[2]: Entering directory `/home/ajg23/GITROOT/BGLCMakeQuestion/build'
> > /usr/bin/cmake -E cmake_progress_report
> > /home/ajg23/GITROOT/BGLCMakeQuestion/build/CMakeFiles 1
> > [100%] Building CXX object CMakeFiles/ReadGraph.dir/ReadGraph.cpp.o
> > /usr/bin/c++     -o CMakeFiles/ReadGraph.dir/ReadGraph.cpp.o -c
> > /home/ajg23/GITROOT/BGLCMakeQuestion/ReadGraph.cpp
> > make[2]: *** No rule to make target `/usr/lib/libboost_graph-mt.so',
> > needed by `ReadGraph'.  Stop.
> > make[2]: Leaving directory `/home/ajg23/GITROOT/BGLCMakeQuestion/build'
> > make[1]: *** [CMakeFiles/ReadGraph.dir/all] Error 2
> > make[1]: Leaving directory `/home/ajg23/GITROOT/BGLCMakeQuestion/build'
> > make: *** [all] Error 2
> >
> >
> > If I don't use ${Boost_LIBRARIES} but explicitly the corresponding
> > libraries (i.e. boost_graph and boost_regex) it compiles without any
> > problem...
> >
> > Can anyone give me a hand on this one? Is this a bug?
> >
> > Note that I have also been trying with the master and the next version
> > of cmake, same thing...
> >
> > Thanks,
> > Arnaud
> >
>
> Looks to me like the symlink /usr/lib/libboost_graph-mt.so doesn't
> exist. Did you check that?
>
> Michael
> --
>
>

Michael,

You were right: the symlink was missing...

Thanks!!
Arnaud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120201/d9033e64/attachment.htm>


More information about the CMake mailing list