[CMake] [CMake General][FindBoost] CMake and Boost 1.46.1

Andrew Maclean andrew.amaclean at gmail.com
Mon May 2 07:10:08 EDT 2011


Hi Robert,

I build boost for windows using bjam and I have no problems with CMake
finding boost.

In my CMake files I do this:

#--------------------------------------------------------------------------
---
# Boost
# For automatic linking, uses the static version of the libraries.
if(WIN32)
  set(Boost_USE_STATIC_LIBS ON)
endif(WIN32)
set(Boost_ADDITIONAL_VERSIONS "1.46.1" )
if ( WIN32 )
  find_package(Boost REQUIRED COMPONENTS system date_time filesystem
thread iostreams regex serialization bzip2 zlib)
else ( WIN32 )
  find_package(Boost REQUIRED COMPONENTS system date_time filesystem
thread iostreams regex serialization)
endif ( WIN32 )
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
  # This is needed for debug builds in windows in boost.
  link_directories(${Boost_LIBRARY_DIRS})
endif ( Boost_FOUND )


As to the file names I don't have a windows machine here at present but I
can check in the morning.


Andrew

-- 
________________________________________

Andrew J. P. Maclean
Australian Centre for Field Robotics (ACFR)
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/
________________________________________







On 2/05/11 15:53, "Robert Nelson" <boardmaster357 at gmail.com> wrote:

>> try ... setting Boost_DEBUG On
>Great suggestion!
>
>I looked at the debug output as you recommended and discovered that
>findboost only searches for filenames that start with "boost"  while
>all the files in the lib directory start with "libboost"
>
>I copied and renamed the regex files in the lib directory to start
>with "boost" instead and it found the regex library but not the
>others.  So a possible solution would be to rename all the files in
>the folder.  This, however, is less than elegant.
>
>Is this a breaking change in the way the boost library files are
>named, a bug in findboost, or did I install boost wrong somehow?
>
>Thanks
>--Robert Nelson
>




More information about the CMake mailing list