|
Boost Interest : |
Subject: [Boost-cmake] Variant Builds and missing libraries
From: Michael Jackson (mike.jackson_at_[hidden])
Date: 2008-11-12 08:54:49
Came across an interesting situation while doing some testing on the
CMake build system. I configured my build tree to be SHARED+MULTI-
THREADED+DEBUG. When I built I was almost immediately getting an error
about not being able to link against boost_test_exec_monitor-mt-
shared. Which is wrong because test_exec_monitor is a static-only
library. As I walked through the CMake code to track down what was the
problem I basically discovered for myself that if you have
BUILD_STATIC=OFF then NO static libraries will be built, which has the
side effect of disabling any regression test that relies on the
test_exec_monitor.
Question: Is this desired behavior? (I wouldn't think so but I
would rather hear that from a boost dev)
Comment: I have a solution in place where I added another optional
argument to the boost_add_library macro that is located in
BoostCore.cmake. The argument is FORCE_VARIANTS followed by the type
of variant that you want to make. So the call to this macro for the
test_exec_monitor looks like the following:
boost_add_library(boost_test_exec_monitor
NO_SHARED
compiler_log_formatter.cpp
debug.cpp
execution_monitor.cpp
framework.cpp
plain_report_formatter.cpp
progress_monitor.cpp
results_collector.cpp
results_reporter.cpp
test_main.cpp
test_tools.cpp
unit_test_log.cpp
unit_test_main.cpp
unit_test_monitor.cpp
unit_test_parameters.cpp
unit_test_suite.cpp
xml_log_formatter.cpp
xml_report_formatter.cpp
FORCE_VARIANTS STATIC
)
This takes care of case where boost_test_exec_monitor was NOT being
built but I still have the case of adding a regression test does not
work. From boost/libs/config/test/CMakeLists.txt:
boost_test_run(limits_test DEPENDS boost_test_exec_monitor)
which will still fail because the current cmake code will look for
some other variant (MT-SHARED) of the boost_test_exec_monitor library.
Question: Should I somehow hard code into boost_test_run() a
conditional test for the test_exec_monitor library being needed and
link to the proper library? Somehow seems "wrong" to do it that way. I
really feel like I am missing something that probably was already
implemented.
Thanks for any feedback or comments.
_________________________________________________________
Mike Jackson mike.jackson_at_[hidden]
BlueQuartz Software www.bluequartz.net
Principal Software Engineer Dayton, Ohio