Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52895 - in branches/release: libs/statechart libs/statechart/example tools/build/CMake tools/build/CMake/LinkTest
From: dgregor_at_[hidden]
Date: 2009-05-11 00:50:35


Author: dgregor
Date: 2009-05-11 00:50:32 EDT (Mon, 11 May 2009)
New Revision: 52895
URL: http://svn.boost.org/trac/boost/changeset/52895

Log:
Fix link and link-fail tests in CMake.

Statechart's examples depend on numeric.

Text files modified:
   branches/release/libs/statechart/example/CMakeLists.txt | 4 ++--
   branches/release/libs/statechart/module.cmake | 2 +-
   branches/release/tools/build/CMake/BoostCore.cmake | 19 ++++++++-----------
   branches/release/tools/build/CMake/BoostTesting.cmake | 14 ++++++++++++++
   branches/release/tools/build/CMake/LinkTest/CMakeLists.txt | 2 +-
   5 files changed, 26 insertions(+), 15 deletions(-)

Modified: branches/release/libs/statechart/example/CMakeLists.txt
==============================================================================
--- branches/release/libs/statechart/example/CMakeLists.txt (original)
+++ branches/release/libs/statechart/example/CMakeLists.txt 2009-05-11 00:50:32 EDT (Mon, 11 May 2009)
@@ -4,9 +4,9 @@
     set(SOURCES ${SOURCES} "${TESTNAME}/${ARG}.cpp")
   endforeach(ARG ${ARGN})
 
- if (NOT)
+ if (NOT SOURCES)
     set(SOURCES "${TESTNAME}/${TESTNAME}.cpp")
- endif (NOT)
+ endif ()
 
   boost_test_link("${TESTNAME}Example"
     ${SOURCES}

Modified: branches/release/libs/statechart/module.cmake
==============================================================================
--- branches/release/libs/statechart/module.cmake (original)
+++ branches/release/libs/statechart/module.cmake 2009-05-11 00:50:32 EDT (Mon, 11 May 2009)
@@ -1 +1 @@
-boost_module (statechart DEPENDS type_traits mpl static_assert intrusive smart_ptr bind function)
\ No newline at end of file
+boost_module (statechart DEPENDS type_traits mpl static_assert intrusive smart_ptr bind function numeric)

Modified: branches/release/tools/build/CMake/BoostCore.cmake
==============================================================================
--- branches/release/tools/build/CMake/BoostCore.cmake (original)
+++ branches/release/tools/build/CMake/BoostCore.cmake 2009-05-11 00:50:32 EDT (Mon, 11 May 2009)
@@ -326,6 +326,14 @@
         endforeach ()
       endif()
 
+ # Create a target <library name>-test, which will run all of
+ # this library's tests.
+ if (THIS_PROJECT_TESTDIRS)
+ add_custom_target(${PROJECT_NAME}-test
+ COMMAND ${CMAKE_CTEST_COMMAND} -R "^${PROJECT_NAME}-*"
+ MESSAGE "Running tests for Boost.${PROJECT_NAME}...")
+ endif ()
+
       # Include the test directories.
       foreach(SUBDIR ${THIS_PROJECT_TESTDIRS})
         add_subdirectory(${SUBDIR})
@@ -1156,9 +1164,6 @@
     )
   set(THIS_LIB_SOURCES ${THIS_LIB_DEFAULT_ARGS})
 
- string(TOUPPER "${LIBNAME}_COMPILED_LIB" compiled_lib)
- set (${compiled_lib} TRUE CACHE INTERNAL "")
-
   if (NOT TEST_INSTALLED_TREE)
     # A top-level target that refers to all of the variants of the
     # library, collectively.
@@ -1212,9 +1217,6 @@
     )
   set(THIS_LIB_SOURCES ${THIS_LIB_DEFAULT_ARGS})
 
- string(TOUPPER "${LIBNAME}_COMPILED_LIB" compiled_lib)
- set (${compiled_lib} TRUE CACHE INTERNAL "")
-
   if (NOT TEST_INSTALLED_TREE)
     boost_select_variant(${LIBNAME} THIS_LIB)
     if (THIS_LIB_VARIANT)
@@ -1382,11 +1384,6 @@
     endforeach(LIB ${THIS_EXE_DEPENDS})
 
     # Build the executable
- # TODO: the use of ${PROJECT_NAME}/${EXENAME} is a bit strange.
- # It's designed to keep the names of regression tests from one library
- # separate from the regression tests of another library, but this can
- # be handled better with OUTPUT_NAME. This would also allow us to eliminate
- # the directory-creation logic in boost_library_project.
     if (THIS_PROJECT_IS_TOOL)
       set(THIS_EXE_NAME ${EXENAME})
     else()

Modified: branches/release/tools/build/CMake/BoostTesting.cmake
==============================================================================
--- branches/release/tools/build/CMake/BoostTesting.cmake (original)
+++ branches/release/tools/build/CMake/BoostTesting.cmake 2009-05-11 00:50:32 EDT (Mon, 11 May 2009)
@@ -282,6 +282,10 @@
         LABELS "${PROJECT_NAME}"
         )
 
+ # Make sure that the -test target that corresponds to this
+ # library or tool depends on this test executable.
+ add_dependencies(${PROJECT_NAME}-test ${THIS_EXE_NAME})
+
       if (BOOST_TEST_FAIL)
         set_tests_properties(${BOOST_TEST_TESTNAME} PROPERTIES WILL_FAIL ON)
       endif ()
@@ -377,6 +381,15 @@
 macro(boost_test_link testname)
   boost_test_parse_args(${testname} ${ARGN} LINK)
   if(BOOST_TEST_OKAY)
+ # Determine the include directories to pass along to the underlying
+ # project.
+ # works but not great
+ get_directory_property(BOOST_TEST_INCLUDE_DIRS INCLUDE_DIRECTORIES)
+ set(BOOST_TEST_INCLUDES "")
+ foreach(DIR ${BOOST_TEST_INCLUDE_DIRS})
+ set(BOOST_TEST_INCLUDES "${BOOST_TEST_INCLUDES};${DIR}")
+ endforeach(DIR ${BOOST_TEST_INCLUDE_DIRS})
+
     add_test(${BOOST_TEST_TESTNAME}
       ${CMAKE_CTEST_COMMAND}
       --build-and-test
@@ -385,6 +398,7 @@
       --build-generator ${CMAKE_GENERATOR}
       --build-makeprogram ${CMAKE_MAKE_PROGRAM}
       --build-project LinkTest
+ --build-options
       "-DSOURCE:STRING=${CMAKE_CURRENT_SOURCE_DIR}/${BOOST_TEST_SOURCES}"
       "-DINCLUDES:STRING=${BOOST_TEST_INCLUDES}"
       "-DCOMPILE_FLAGS:STRING=${BOOST_TEST_COMPILE_FLAGS}"

Modified: branches/release/tools/build/CMake/LinkTest/CMakeLists.txt
==============================================================================
--- branches/release/tools/build/CMake/LinkTest/CMakeLists.txt (original)
+++ branches/release/tools/build/CMake/LinkTest/CMakeLists.txt 2009-05-11 00:50:32 EDT (Mon, 11 May 2009)
@@ -2,6 +2,6 @@
 
 project(LinkTest)
 include_directories (${INCLUDES})
-add_executable(link-test ${SOURCE} COMPILE_FLAGS "${COMPILE_FLAGS}")
+add_executable(link-test ${SOURCE})
 set_source_files_properties(${SOURCE}
   PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
\ No newline at end of file


Boost-Commit 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