Boost logo

Boost Interest :

Subject: Re: [Boost-cmake] Problem building NSIS installer.
From: Miguel A. Figueroa-Villanueva (miguelf_at_[hidden])
Date: 2009-07-22 11:54:43


On Wed, Jul 22, 2009 at 10:09 AM, Doug Gregor wrote:
> On Wed, Jul 22, 2009 at 12:12 AM, Miguel A. Figueroa-Villanueva wrote:
>> On Wed, Jul 22, 2009 at 1:06 AM, Doug Gregor wrote:
[...]
>> Ok, I've traced the problem to the following:
>>
>> -- libs/python/CMakeLists.txt: is encapsulated in a "if (PYTHON_LIBRARIES)"
>> -- libs/parameter/module.cmake states a dependency on the python lib
>>
>> So, I think the solution is to wrap the macro call in
>> libs/parameter/CMakeLists.txt with the "if (PYTHON_LIBRARIES)"?
>
> ... and you don't have Python installed, or CMake isn't finding Python.
>

Right, I have the python executable from cygwin found, but I don't
have the headers or they aren't found, but this is besides the
point... In the sense that that is the whole point of having a nice
build system like CMake :)

I just want the boost::any and boost::program_options at the moment,
so all other things should not get in my way (unless it is a
dependency of course).

>> BTW, does this mean that a header-only library (parameter) depends on
>> a compiled lib (python)?
>
> It's an odd dependency. One header file in the parameter library
> depends on Boost.Python. If you don't have Boost.Python, you just
> can't use that header.

Ok, that is sensible and it shouldn't be difficult to enforce that the
parameter library is only available if Python is found and selected
for building.

BTW, in the wiki I saw a reference to BUILD_BOOST_<LIB> variables for
cmake, which I don't get (at least with the boost/branches/release
branch that I downloaded as recommended at the boost-cmake site). Was
this removed or an unimplemented feature?

FWIW, the way I think the system should work is as follows:

1. detect dependencies through FindXXX modules and for those
dependencies that have been satisfied, present the BUILD_BOOST_<LIB>
to the user (it may be ON by default, but then you allow to turn it
off). So, for bringing in python it should be wrapped in something
like this:

-- libs/python/CMakeLists.txt
if (PYTHONLIBS_FOUND)
  option(BUILD_BOOST_PYTHON "build boost::python library" ON)
  if (BUILD_BOOST_PYTHON)
    ...
  endif()
endif()

2. Then all libraries that depend on any of these compiled libs should
be wrapped in the respective BUILD_BOOST_<LIB> variables. For example,
for the parameter library:

-- libs/parameter/CMakeLists.txt
if (BUILD_BOOST_PYTHON)
  ...
endif()

Header-only libs shouldn't be a problem, since the component installer
can deal with installing just what you want. Which I find very nice,
thanks!!

I also find very awkward/confusing the amount of libs built... the
usual CMake way is to present mutually exclusive options (e.g.,
BUILD_STATIC; with ON builds static, with OFF builds shared) and then
just build one set of libs. You can have multiple build directories
for each set of libs you want to build. But this is another topic ;)

Thanks for the help.
--Miguel


Boost-cmake list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk