[CMake] Linking to a library with a "-"

Andreas Pakulat apaku at gmx.de
Wed Apr 15 11:49:16 EDT 2009


On 15.04.09 11:09:43, David Doria wrote:
> I'm using Fedora 10. The KDevelop3 and normal makefile generator produce the
> same result.  CMake version: ccmake version 2.6-patch 3
> 
> My CMakeLists.txt file is:
> --------------------------------------------------------
> cmake_minimum_required(VERSION 2.6)
> 
> Project(BoostProgramOptions)
> 
> INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} /home/doriad/src/boost)
> 
> LINK_DIRECTORIES(${LINK_DIRECTORIES} /home/doriad/bin/boost/lib)
> 
> ADD_EXECUTABLE(BoostProgramOptions BoostProgramOptions.cpp)
> TARGET_LINK_LIBRARIES(BoostProgramOptions boost_program_options)
                                            ^^^^^^^^^^^^^^^^^^^^^^
 
> ADD_EXECUTABLE(MultipleLists MultipleLists.cpp)
> TARGET_LINK_LIBRARIES(MultipleLists boost_program_options-mt)
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^

Do you notice a difference?

> --------------------------------------------------------
> 
> and the link.txt that is produced is:
> 
> --------------------------------------------------------
> /usr/lib/ccache/c++     -fPIC
> CMakeFiles/BoostProgramOptions.dir/BoostProgramOpt
> ions.cpp.o  -o BoostProgramOptions -rdynamic -L/home/doriad/bin/boost/lib
> -lboos
> t_program_options -Wl,-rpath,/home/doriad/bin/boost/lib
> --------------------------------------------------------

This link.txt is for BoostProgramOptions which you specified should link
against "boost_program_options" not "boost_program_options-mt".

Andreas

-- 
Try to value useful qualities in one who loves you.


More information about the CMake mailing list