[CMake] FindBoost not setting Boost_LIBRARIES

Andrew Maclean andrew.amaclean at gmail.com
Tue May 11 21:32:15 EDT 2010


This works for me:

#-----------------------------------------------------------------------------
# Boost
  # The automatic linking, uses the static version of the libraries.
  if(WIN32)
    set(Boost_USE_STATIC_LIBS ON)
  endif(WIN32)

  # Uncomment and edit if CMake cannot find boost.
  set(Boost_ADDITIONAL_VERSIONS "1.43" "1.43.0" "1.42" "1.42.0")
  find_package(Boost REQUIRED COMPONENTS system filesystem )
  if ( Boost_FOUND )
    include_directories(${Boost_INCLUDE_DIRS})
    add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
    # Remember to include ${Boost_LIBRARIES} in the
target_link_libraries() statement
  endif ( Boost_FOUND )


Regards
   Andrew



On Wed, May 12, 2010 at 10:31 AM, Michael Hertling <mhertling at online.de> wrote:
> On 05/12/2010 01:06 AM, McNamara, Nate wrote:
>> Hello!
>>
>> I've been struggling with find_package(boost ...): although it succeeds
>> up to a point, it doesn't finish the job.  I must be doing something
>> wrong.
>>
>> The output below shows that boost is found, and several of the expected
>> variables are set, but Boost_LIBRARIES is not.  I suspect that means
>> that, although the boost installation was found, the particular
>> component (i.e., the unit_test_framework) was not.
>>
>> The weird thing is that, when I get to the link step, link knows the
>> exact file name it should link, but doesn't find it:
>>
>>       1>LINK : fatal error LNK1104: cannot open file
>> 'libboost_unit_test_framework-vc80-mt-gd-1_42.lib'
>>
>> Any hints much appreciated!
>> Nate
>>
>>
>>
>> H:\devel\build>type CMakeLists.txt
>> cmake_minimum_required(VERSION 2.8)
>> project(foo)
>>
>> set(Boost_DEBUG TRUE)
>> find_package(boost REQUIRED COMPONENTS unit_test_framework)
>> message(STATUS "Boost_VERSION=" ${Boost_VERSION})
>> message(STATUS "Boost_LIBRARIES=" ${Boost_LIBRARIES})
>> message(STATUS "Boost_LIBRARY_DIRS=" ${Boost_LIBRARY_DIRS})
>> message(STATUS "Boost_INCLUDE_DIRS=" ${Boost_INCLUDE_DIRS})
>
> Is the lower-case "b" in "find_package(boost ...)" just a typo? On
> Linux, this CMakeLists.txt file fails completely as Boost must be
> requested with upper-case "B", i.e. "find_package(Boost ...)".
>
> Additionally, I get the following:
>
> [...]
> -- Boost version: 1.43.0
> -- Found the following Boost libraries:
> --   unit_test_framework
> -- Boost_VERSION=104300
> [..]
>
> The line containing "Found the following..." and the subsequent list of
> detected Boost libraries are missing in your log. Furthermore, I can
> reproduce your results by issuing "find_package(Boost)", i.e. by not
> requesting any of Boost's libraries. Perhaps, this somewhat helps.
>
> Regards,
>
> Michael
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
___________________________________________
Andrew J. P. Maclean
Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney  2006  NSW
AUSTRALIA
Ph: +61 2 9351 3283
Fax: +61 2 9351 7474
URL: http://www.acfr.usyd.edu.au/
___________________________________________


More information about the CMake mailing list