Boost logo

Boost Interest :

Subject: Re: [Boost-cmake] CMake modularization update
From: Doug Gregor (doug.gregor_at_[hidden])
Date: 2008-10-31 20:55:46


On Fri, Oct 31, 2008 at 6:13 PM, Michael Jackson
<mike.jackson_at_[hidden]> wrote:
> macro(boost_test_add_dependent_includes includes)
> foreach (include ${includes})
> #message(STATUS "include: ${include}")
> include_directories("${Boost_SOURCE_DIR}/libs/${include}/include")
> endforeach (include ${includes})
> endmacro(boost_test_add_dependent_includes includes)
>
> Which for some of the testing cmake files is being invoked like this:
>
> #-------------------------------------------------------------------------
> #-- Needed include directories for the tests
> boost_test_add_dependent_includes("utility;detail;config;test;mpl;\
> bind;type_traits;static_assert;preprocessor;array;iterator;exception;range;timer")
> #-------------------------------------------------------------------------
>
> Which is getting ugly quick. I was wanting to do something like is done with
> the "module.cmake" file to just list the upper dependencies and let cmake
> figure out all the rest.

The issue here is that we need to describe some dependencies that are
only needed for testing, but not for the actual library build? It
seems like there should just be another dependency argument
(TEST_DEPENDS or something) in each module.cmake for each library, so
that the direct dependencies are expressed for tests as well as for
the library build. Then we can use logic like what
boost_library_project has, to compute all of dependencies
(transitively) and then add each of those include directories. The
code I'm talking about is:

77 # Set THIS_PROJECT_DEPENDS_ALL to the set of all of its
78 # dependencies, its dependencies' dependencies, etc., transitively.
79 string(TOUPPER "BOOST_${LIBNAME}_DEPENDS" THIS_PROJECT_DEPENDS)
80 set(THIS_PROJECT_DEPENDS_ALL ${${THIS_PROJECT_DEPENDS}})
81 set(ADDED_DEPS TRUE)
82 while (ADDED_DEPS)
83 set(ADDED_DEPS FALSE)
84 foreach(DEP ${THIS_PROJECT_DEPENDS_ALL})
85 string(TOUPPER "BOOST_${DEP}_DEPENDS" DEP_DEPENDS)
86 foreach(DEPDEP ${${DEP_DEPENDS}})
87 list(FIND THIS_PROJECT_DEPENDS_ALL ${DEPDEP} DEPDEP_INDEX)
88 if (DEPDEP_INDEX EQUAL -1)
89 list(APPEND THIS_PROJECT_DEPENDS_ALL ${DEPDEP})
90 set(ADDED_DEPS TRUE)
91 endif()
92 endforeach()
93 endforeach()
94 endwhile()

  - Doug


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