Visual C++ 11 cannot find Boost unit_test_framework library in CMake generated project

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.

AMDG On 04/04/2013 10:38 AM, Emre Şahin wrote:
<snip> 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?
boost_* is the import library for the DLL. If it's not on the command line, then it must be getting picked up by auto-linking. Since you aren't using auto-linking, make sure that all sources are compiled with -DBOOST_ALL_NO_LIB. In Christ, Steven Watanabe

[Please do not mail me a copy of your followup]
boost-users@lists.boost.org spake the secret code
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. [...]
It seems like this is really a CMake problem and not a Boost problem. -- "The Direct3D Graphics Pipeline" free book http://tinyurl.com/d3d-pipeline The Computer Graphics Museum http://computergraphicsmuseum.org The Terminals Wiki http://terminals.classiccmp.org Legalize Adulthood! (my blog) http://legalizeadulthood.wordpress.com
participants (3)
-
Emre Şahin
-
legalize+jeeves@mail.xmission.com
-
Steven Watanabe