[CMake] Patch to find Boost under Windows

Judicaël Bedouet j.bedouet at infonie.fr
Tue Sep 2 18:01:38 EDT 2008


Hello,

Under Windows, I can't find Boost libraries.

I have downloaded Multithread DLL for Visual Studio 2003 and tried to find
them with CMake 2.6-1. Boost version is 1.35
CMake finds headers but can't find libraries. CMake search the following
directories :

   - C:/boost/lib
   - C:/boost
   -
   $ENV{ProgramFiles}/boost/boost_${Boost_FIND_VERSION_MAJOR}_${Boost_FIND_VERSION_MINOR}_${Boost_FIND_VERSION_PATCH}
   - $ENV{ProgramFiles}/Boost

Third path refers to variables ${Boost_FIND_VERSION_MAJOR},
${Boost_FIND_VERSION_MINOR} and ${Boost_FIND_VERSION_PATCH} but I don't want
to specify a specific version. So, this paths is valued at C:\Program
Files/boost/boost___/lib.

Standard Boost installer installs libraries to "C:\Program
Files\boost\boost_1_35_0\lib".

So, I suggest this patch. After reading Boost_LIB_VERSION and Boost_VERSION
in boost/version.hpp, we could add path
$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib
to library search dirs. It works fine for me.

Could this be applied to future CMake versions ?

Thanks,

J. Bedouet


  IF(Boost_INCLUDE_DIR)
    ...
    IF(NOT "${Boost_VERSION}" STREQUAL "0")
      ...
    ENDIF(NOT "${Boost_VERSION}" STREQUAL "0")

>    SET(_boost_LIBRARIES_SEARCH_DIRS
>     ${_boost_LIBRARIES_SEARCH_DIRS}
>
"$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib"
>    )

  ELSE(Boost_INCLUDE_DIR)
    ...
  ENDIF(Boost_INCLUDE_DIR)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080903/84495d93/attachment.htm>


More information about the CMake mailing list