Boost logo

Boost Users :

Subject: [Boost-users] Visual C++ 11 cannot find Boost unit_test_framework library in CMake generated project
From: Emre Åžahin (i.emre.sahin_at_[hidden])
Date: 2013-04-04 13:38:08


I have a C++ project using CMake and Boost that compiles/links under Linux
without any problems. I'm working towards porting this to Windows via
Visual C++ 2012.

My CMake configuration is as follows:

    set(BOOST_ROOT ${DEPENDENCY_DIR}/boost/)
    set(Boost_USE_STATIC_LIBS ON)
    set(Boost_USE_MULTITHREADED ON)
    set(Boost_USE_STATIC_RUNTIME OFF)
    find_package(Boost 1.53 COMPONENTS system date_time chrono
serialization filesystem program_options random thread regex
unit_test_framework)

    message(STATUS "Boost Version:" ${Boost_VERSION})
    message(STATUS "Boost Include Dirs:" ${Boost_INCLUDE_DIR})
    message(STATUS "Boost Libraries:")
    foreach(lib ${Boost_LIBRARIES})
        message(STATUS ${lib})
    endforeach()

    include_directories(${Boost_INCLUDE_DIR})

and I'm using `target_link_libraries` with `${Boost_LIBRARIES}` in my
targets. Also above `message` commands show all found files without any
problem.

Moreover required libraries show
`libboost_unit_test_framework-vc110-mt-gd-1_53.lib` as it should be.
(Screenshot: http://i.stack.imgur.com/UgPTG.png)

However, when I build one of the targets, I get

    2>LINK : fatal error LNK1104: cannot open file
'boost_unit_test_framework-vc110-mt-gd-1_53.lib'

I removed another Boost library and from the error it seems the linker is
able to find others. (like `chrono` or `serialization`.) But the error
message is a bit different. The filename has _lib_ in front of it.

    2>LINK : fatal error LNK1104: cannot open file
'libboost_serialization-vc110-mt-gd-1_53.lib'

Why does VC++ looks for a file prefixed with **boost** and not **libboost**
for unit_test_framework?

Best Regards,

Emre

PS: This is crossposted to http://stackoverflow.com/questions/15815467/ if
you like to answer there.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net