Michael Jackson wrote: > This is THE SINGLE IMPROVEMENT someone could make for those of us using > CMake and are dependent on the boost libraries. Finding Boost with CMake > is historically a pain and is extremely error prone. There is no support > for future versions in the current FindBoost. You can take a guess, but > that is about all it is. > > If I had the time (which I don't.. ) I would add a "UseBoost.cmake" > file that gets configured and installed with Boost. inside that file > would be all the usual cmake variables that get set when FindBoost.cmake > is run: > > Boost_INCLUDE_DIR > Boost_LIBRARY_DIRS > Boost_PROGRAM_OPTIONS_LIBRARY > Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG > Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE > > Boost_VERSION.. and on and on. > > FindBoost.cmake boils down to looking for that file FIRST, then > defaulting to the usual search that it currently does. Just my own "wish > list"..
I'll elaborate. (FYI, I'm the author of CMake's find_package() command.) Currently CMake's FindBoost module must detect headers, libraries, and other individual parts of the Boost installation separately. This is tedious and error-prone because a user might have to set each result, and the locations chosen might not correspond to the same installation. It is better to provide a single file with the installation that knows where everything was put (relative to its own location). What Michael proposes is to install CMake Package Configuration files with Boost. This is a pair of files like: <prefix>/lib/boost-1.41.0/cmake/BoostConfig.cmake <prefix>/lib/boost-1.41.0/cmake/BoostConfigVersion.cmake which will help a user project that writes code like find_package(Boost 1.41 REQUIRED) find a suitable Boost version. BoostConfig.cmake describes the installation with which it is provided. # Compute _PREFIX relative to file location (contained in Boost_DIR). get_filename_component(_PREFIX "${Boost_DIR}/../../.." ABSOLUTE) # ../../.. goes up to prefix # Details of corresponding installation... set(Boost_VERSION 1.41.0) set(Boost_INCLUDE_DIRS ${_PREFIX}/include/boost-1.41.0) set(Boost_LIBRARY_DIRS ${_PREFIX}/lib/boost-1.41.0) # ... BoostConfigVersion.cmake decides whether its version of Boost is a compatible or exact match for the version requested. It might contain something like: set(PACKAGE_VERSION "1.41.0") if("${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}" VERSION_EQUAL "1.41") set(PACKAGE_VERSION_COMPATIBLE 1) if("${PACKAGE_FIND_VERSION_MINOR}" VERSION_EQUAL "0") set(PACKAGE_VERSION_EXACT 1) endif() endif() This tells the find_package command to accept any 1.41.x as compatible with a request for 1.41.y, but only 1.41.y as an EXACT match. CMake prescribes no version numbering system...it is fully determined by package-provided files. See also http://www.cmake.org/Wiki/CMake_2.6_Notes#Packages http://www.cmake.org/cmake/help/cmake2.6docs.html#command:find_package Note that all of the above is possible even for a non-CMake boost build. Once a version of Boost is known to provide this file, we can teach CMake's FindBoost.cmake module to take advantage of it...which should be the last time we need to change the module. -Brad _______________________________________________ Boost-cmake mailing list Boost-cmake@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-cmake