Boost logo

Boost Interest :

Subject: Re: [Boost-cmake] link tests
From: Brad King (brad.king_at_[hidden])
Date: 2009-05-20 15:13:44


troy d. straszheim wrote:
> I was trying to fix asio link tests and hit a couple of snags. I put in
> a workaround (which I bet breaks more than it fixes) and would like some
> feedback from kitware. The problems i was trying to fix:

We generally build all test executables and libraries during the normal
build step. Then it all compiles/links at build time and has full access
to targets and flags.

Everything except compile-fail and link-fail tests should eventually be
combined into test driver executables for each library.

> 1. The test is to ensure that linking against another built library
> succeeds. Typically cmake handles things internally with absolute paths
> (not with -L). How do I send the full path of e.g. boost_system, which
> is hidden from me, to a ctest process (which in turn invokes a cmake
> process, whch invokes a make process)?

The whole idea of --build-and-test is to build a project outside the tree
as if it is a user project. A user project won't know the paths unless
it does a find_package(Boost). Ideally boost-cmake should provide a
boost package using the method documented here:

   http://www.cmake.org/Wiki/CMake_2.6_Notes

It is possible to provide a package directly from the build tree as well
as in an install tree. Then the build-and-test step can point Boost_DIR
directly at its build tree and everything will work.

> 2. The link tests didn't obey CMAKE_CXX_COMPILER, etc. Compile tests
> probably still don't...

CTest's --build-and-test mode has a '--build-options' argument. Pass
the compiler through it:

   ... -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} ...

-Brad


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