From 5d8b48b6c618a4294e03bac5ba8cf82d5a0abcd1 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 8 May 2009 14:55:00 +0000 Subject: [PATCH] Allow subsetting the set of Boost libraries to test in CMake via BOOST_TEST_LIBRARIES [SVN r52851] --- CMake/BoostCore.cmake | 15 ++++++++++++++- CMake/BoostTesting.cmake | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CMake/BoostCore.cmake b/CMake/BoostCore.cmake index c714b0d7d..a25c01425 100644 --- a/CMake/BoostCore.cmake +++ b/CMake/BoostCore.cmake @@ -313,7 +313,20 @@ macro(boost_library_project LIBNAME) if(BUILD_TESTING AND THIS_PROJECT_TESTDIRS) # Testing is enabled globally and this project has some - # tests. So, include the tests + # tests. Check whether we should include these tests. + if (BOOST_TEST_LIBRARIES) + set(SAVED_TESTDIRS ${THIS_PROJECT_TESTDIRS}) + set(THIS_PROJECT_TESTDIRS) + foreach (TESTLIB ${BOOST_TEST_LIBRARIES}) + if (${TESTLIB} STREQUAL ${libname}) + # We are allowed to test this library; restore the set of + # test directories for this library. + set(THIS_PROJECT_TESTDIRS ${SAVED_TESTDIRS}) + endif() + endforeach () + endif() + + # Include the test directories. foreach(SUBDIR ${THIS_PROJECT_TESTDIRS}) add_subdirectory(${SUBDIR}) endforeach() diff --git a/CMake/BoostTesting.cmake b/CMake/BoostTesting.cmake index 8567430f1..1afdfbd73 100644 --- a/CMake/BoostTesting.cmake +++ b/CMake/BoostTesting.cmake @@ -43,6 +43,9 @@ if (BUILD_TESTING) enable_testing() option(TEST_INSTALLED_TREE "Enable testing of an already-installed tree" OFF) + + set(BOOST_TEST_LIBRARIES "" + CACHE STRING "Semicolon-separated list of Boost libraries to test") if (TEST_INSTALLED_TREE) include("${CMAKE_INSTALL_PREFIX}/lib/Boost${BOOST_VERSION}/boost-targets.cmake")