[CMake] Boost with CMake?

Andrew Maclean a.maclean at cas.edu.au
Fri Oct 7 19:41:28 EDT 2005


I do this, which works on Linux and XP. By the way I have suggested to Boost
that they consider CMake but they are "firmly" wedded to BJam!



#---------------------------------------------------------------------------
--
# Boost includes and libraries.

IF ( WIN32 )
  # Assumes BOOST_ROOT and BOOST_THREAD_* are set in your path statement.
  # If not then either add them to your path statement or edit the following
  # lines putting in the absolute paths to the boost includes and libraries.
  SET ( Boost_Root
#    $(BOOST_ROOT)
#    $ENV{BOOST_ROOT}
    "C:/boost/boost_1_33_0"
    CACHE PATH
    "Path to the boost root directory."
  )
  SET(BOOST_INCLUDE_PATH
    ${Boost_Root}
    CACHE PATH
    "Path to the Boost include files.")

  #SET(BOOST_REGEX_MT_LIB_PATH
  #
${Boost_Root}/bin/boost/libs/regex/build/libboost_regex.lib/vc-7_1/release/t
hreading-multi
  #  CACHE PATH
  #  "Path to the Boost multi-threaded regular expression release
libraries.")
  #SET(BOOST_REGEX_MT_D_LIB_PATH
  #
${Boost_Root}/bin/boost/libs/regex/build/libboost_regex.lib/vc-7_1/debug/thr
eading-multi
  #  CACHE PATH
  #  "Path to the Boost multi-threaded regular expression debug libraries.")
  #SET(BOOST_THREAD_MT_LIB_PATH
  #  "$(BOOST_THREAD_MT)"
  #  CACHE PATH
  #  "Path to the Boost multi-threaded thread release libraries.")
  #SET(BOOST_THREAD_MT_D_LIB_PATH
  #  "$(BOOST_THREAD_MT_D)"
  #  CACHE PATH
  #  "Path to the Boost multi-threaded thread debug libraries.")
  SET(BOOST_FS_MT_LIB_PATH
 
${Boost_Root}/bin/boost/libs/filesystem/build/libboost_filesystem.lib/vc-7_1
/release/threading-multi
    CACHE PATH
    "Path to the Boost multi-threaded thread filesystem release libraries.")
  SET(BOOST_FS_MT_D_LIB_PATH
 
${Boost_Root}/bin/boost/libs/filesystem/build/libboost_filesystem.lib/vc-7_1
/debug/threading-multi
    CACHE PATH
    "Path to the Boost multi-threaded thread filesystem debug libraries.")

ELSE ( WIN32 )
  # In Linux the includes are generally in the system paths. I.e
/usr/include/boost
  # In Linux the libs are generally in the system paths. I.e. /usr/lib ->
  # If you build and install boost yourself, the headers are in:
/usr/local/include/boost-1_33/
  # and the libraries are in: /usr/local/lib/

  #  "Path to the Boost multi-threaded thread debug libraries.")
  SET(BOOST_INCLUDE_PATH
    /usr/local/include/boost-1_33/
    CACHE PATH
    "Path to the Boost include files.")
ENDIF ( WIN32 )
#---------------------------------------------------------------------------
--












Regards
   Andrew










-----Original Message-----
From: Kim Rasmussen [mailto:kml at elreki.net] 
Sent: Friday, 7 October 2005 08:29
To: cmake at cmake.org
Subject: [CMake] Boost with CMake?

Hi!

I'd like to use the Boost C++ libraries (www.boost.org) in my 
CMake-based projects.

What's the best way to do this?

Preferably, I'd like to have a kind of "FindBoost.cmake" module which 
provides the include and library paths.


Ideas and tips would be greatly appreciated.

Cheers,
Kim





More information about the CMake mailing list