|
Boost Interest : |
Subject: Re: [Boost-cmake] CMake thoughts
From: Michael Jackson (mike.jackson_at_[hidden])
Date: 2009-06-08 09:38:45
Thoughts are inline..
On Jun 2, 2009, at 3:40 AM, Robert Bielik wrote:
> Hi,
>
> The preliminary CMake file in the distr. (1.38.0) is IMHO way, WAY
> too complex. It makes no sense to have each sublib as a separate
> project, and in all different flavors at that (debug/rel/mt/st). It
> seems as it is designed just to create
> the boost libraries, which in my view in a non-sensical approach of
> using CMake since boost is a library, not a standalone application.
>
> The CMake file should be designed for inclusion in user CMake
> hierarchies, so I'd like a much more simple variant akin towards this:
>
> project(boost)
>
> option(BOOST_BUILD_STATIC_LIBRARY "Build Boost as STATIC library" ON)
>
> set(BOOST_INCLUDED_LIBRARIES
> <list of all the sublibraries wanted/needed>
> )
>
> # Collect all the files needed into variable BOOST_SOURCE_FILES
> using the
> # list from above
> file(GLOB ...)
file(glob... ) is just BAD. It only runs once so if you add more files
to boost then you have to completely clean your build dir, rerun cmake
and make again which for the boost devs is not going to work.
>
>
> if (BOOST_BUILD_STATIC_LIBRARY)
> add_library(boost STATIC ${BOOST_SOURCE_FILES})
> else (BOOST_BUILD_STATIC_LIBRARY)
> add_library(boost DYNAMIC ${BOOST_SOURCE_FILES})
> endif (BOOST_BUILD_STATIC_LIBRARY)
>
> This way I can easily incorporate boost into my own CMake hierarchy
> for creating my own projects and not clutter the
> workspace with hundreds of projects all with different settings.
>
> Just my 2 cents.
>
> Regards
> /Rob
> Ps. Apologies if I'm kicking in already opened doors.
>
What _really_ needs to be done, for BOTH the bjam and the cmake based
builds is to produce a "UseBoost.cmake" file akin to the UseQt4,
UseVTK, UseITK, UseParaView that are either included with CMake or
produced by the build system then installed into the installation
location. This way all the user of boost has to include is something
like the following:
# --------------------------------------------------------------------
# Find the Boost Package
# --------------------------------------------------------------------
FIND_PACKAGE(Boost)
IF(Boost_FOUND)
# INCLUDE(${USE_Boost_FILE})
ELSE()
MESSAGE(FATAL_ERROR "Cannot build without Boost. Please set
Boost_ROOT.")
ENDIF()
Inside the USE_Boost_FILE would be all the variables the current
FindBoost.cmake has but actually with "solid" ways of finding the
libraries, library types, (MT, ST, STATIC, DYNAMIC), versions (1.39.4)
and anything else that is needed (include directories, link
directories) and all that.
2 cents worth.
Mike Jackson
www.bluequartz.net