Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49682 - trunk/tools/build/CMake
From: mike.jackson_at_[hidden]
Date: 2008-11-11 08:22:15


Author: imikejackson
Date: 2008-11-11 08:22:13 EST (Tue, 11 Nov 2008)
New Revision: 49682
URL: http://svn.boost.org/trac/boost/changeset/49682

Log:
Changes to core and testing cmake macros
Text files modified:
   trunk/tools/build/CMake/BoostCore.cmake | 39 ++++++++++++--
   trunk/tools/build/CMake/BoostTesting.cmake | 106 +++++++++++++++++++++++++++++++++------
   2 files changed, 122 insertions(+), 23 deletions(-)

Modified: trunk/tools/build/CMake/BoostCore.cmake
==============================================================================
--- trunk/tools/build/CMake/BoostCore.cmake (original)
+++ trunk/tools/build/CMake/BoostCore.cmake 2008-11-11 08:22:13 EST (Tue, 11 Nov 2008)
@@ -307,7 +307,7 @@
     # Include each of the source directories
     if(THIS_PROJECT_SRCDIRS)
       foreach(SUBDIR ${THIS_PROJECT_SRCDIRS})
- add_subdirectory(${SUBDIR})
+ add_subdirectory(${SUBDIR})
       endforeach(SUBDIR ${THIS_PROJECT_SRCDIRS})
     endif()
 
@@ -322,8 +322,9 @@
       # logs are in, has to match the binary directory
       # passed to 'add_subdirectory', in the foreach() just below
       boost_post_results(${PROJECT_NAME} ${PROJECT_NAME}-test
- test
- ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-test)
+ test
+ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-test
+ )
 
       foreach(SUBDIR ${THIS_PROJECT_TESTDIRS})
         add_subdirectory(${SUBDIR} ${PROJECT_NAME}-test)
@@ -387,7 +388,19 @@
   endif()
 endmacro(boost_tool_project)
 
-# TODO: Document me! (Here and on the Trac)
+#TODO: Finish this documentation
+# Defines dependencies of a boost project and testing targets. Use as:
+#
+# boost_module(libname
+# DEPENDS srcdir1 srcdir2 ...
+# TEST_DEPENDS testdir1 testdir2 ...
+#
+# Example:
+# boost_library_project(
+# Thread
+# SRCDIRS src
+# TESTDIRS test
+# )
 macro(boost_module LIBNAME)
   parse_arguments(THIS_MODULE
     "DEPENDS"
@@ -398,6 +411,15 @@
   # Export BOOST_${LIBNAME}_DEPENDS
   string(TOUPPER "BOOST_${LIBNAME}_DEPENDS" THIS_MODULE_LIBNAME_DEPENDS)
   set(${THIS_MODULE_LIBNAME_DEPENDS} ${THIS_MODULE_DEPENDS})
+ #
+ #message(STATUS "----------------------------------------------------------------")
+ #message(STATUS "LIBNAME: ${LIBNAME}")
+ #message(STATUS "THIS_MODULE_DEPENDS: ${THIS_MODULE_DEPENDS}")
+ #message(STATUS "THIS_MODULE_LIBNAME_DEPENDS: ${THIS_MODULE_LIBNAME_DEPENDS}")
+ #message(STATUS "${THIS_MODULE_LIBNAME_DEPENDS}: ${${THIS_MODULE_LIBNAME_DEPENDS}}")
+ #message(STATUS "THIS_MODULE_TEST_DEPENDS: ${THIS_MODULE_TEST_DEPENDS}")
+ #message(STATUS "THIS_MODULE_LIBNAME_TEST_DEPENDS: ${THIS_MODULE_LIBNAME_TEST_DEPENDS}")
+ #message(STATUS "${THIS_MODULE_LIBNAME_TEST_DEPENDS}: ${${THIS_MODULE_LIBNAME_TEST_DEPENDS}}")
 endmacro(boost_module)
 
 # This macro is an internal utility macro that builds the name of a
@@ -647,9 +669,9 @@
       # different names, so we follow the Boost.Build version 2 style
       # and prepend "lib" to the name.
       if(WIN32 AND NOT CYGWIN)
- set(LIBPREFIX "lib")
+ set(LIBPREFIX "lib")
       else(WIN32 AND NOT CYGWIN)
- set(LIBPREFIX "")
+ set(LIBPREFIX "")
       endif(WIN32 AND NOT CYGWIN)
       
       # Add the library itself
@@ -1019,6 +1041,11 @@
     )
   set(THIS_LIB_SOURCES ${THIS_LIB_DEFAULT_ARGS})
 
+ string(TOUPPER "${LIBNAME}_COMPILED_LIB" var)
+ # message(STATUS "var: ${var}")
+ set (${var} TRUE CACHE INTERNAL "")
+ # message(STATUS "${var}: ${${var}}")
+
   if (NOT TEST_INSTALLED_TREE)
     # A top-level target that refers to all of the variants of the
     # library, collectively.

Modified: trunk/tools/build/CMake/BoostTesting.cmake
==============================================================================
--- trunk/tools/build/CMake/BoostTesting.cmake (original)
+++ trunk/tools/build/CMake/BoostTesting.cmake 2008-11-11 08:22:13 EST (Tue, 11 Nov 2008)
@@ -28,6 +28,9 @@
 #
 # boost_test_compile_fail: Tests that the given source file produces
 # errors when compiled.
+#
+# boost_additional_test_dependencies: Adds needed include directories for
+# the tests.
 
 # User-controlled option that can be used to enable/disable regression
 # testing. By default, we disable testing, because most users won't
@@ -57,18 +60,83 @@
 endif(BOOST_BUILD_SANITY_TEST)
 
 
-# This macro is an internal utility macro that helps parse the
-# arguments passed to the Boost testing commands. It will generally
-# not be used by Boost developers.
-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)
-
-
+#-------------------------------------------------------------------------------
+# This macro adds additional include directories based on the dependencies of
+# the library being tested 'libname' and all of its dependencies.
+#
+# boost_additional_test_dependencies(libname
+# BOOST_DEPENDS libdepend1 libdepend2 ...)
+#
+# libname is the name of the boost library being tested. (signals)
+#
+# There is mandatory argument to the macro:
+#
+# BOOST_DEPENDS: The list of the extra boost libraries that the test suite will
+# depend on. You do NOT have to list those libraries already listed by the
+# module.cmake file as these will be used.
+#
+#
+# example usage:
+# boost_additional_test_dependencies(signals BOOST_DEPENDS test optional)
+#
+macro(boost_additional_test_dependencies libname)
+ parse_arguments(BOOST_TEST
+ "BOOST_DEPENDS"
+ ""
+ ${ARGN}
+ )
+ # Get the list of libraries that this test depends on
+ # Set THIS_PROJECT_DEPENDS_ALL to the set of all of its
+ # dependencies, its dependencies' dependencies, etc., transitively.
+ string(TOUPPER "BOOST_${libname}_DEPENDS" THIS_PROJECT_DEPENDS)
+ set(THIS_TEST_DEPENDS_ALL ${libname} ${${THIS_PROJECT_DEPENDS}} )
+ set(ADDED_DEPS TRUE)
+ while (ADDED_DEPS)
+ set(ADDED_DEPS FALSE)
+ foreach(DEP ${THIS_TEST_DEPENDS_ALL})
+ string(TOUPPER "BOOST_${DEP}_DEPENDS" DEP_DEPENDS)
+ foreach(DEPDEP ${${DEP_DEPENDS}})
+ list(FIND THIS_TEST_DEPENDS_ALL ${DEPDEP} DEPDEP_INDEX)
+ if (DEPDEP_INDEX EQUAL -1)
+ list(APPEND THIS_TEST_DEPENDS_ALL ${DEPDEP})
+ set(ADDED_DEPS TRUE)
+ endif()
+ endforeach()
+ endforeach()
+ endwhile()
+
+ # Get the list of dependencies for the additional libraries arguments
+ foreach(additional_lib ${BOOST_TEST_BOOST_DEPENDS})
+ list(FIND THIS_TEST_DEPENDS_ALL ${additional_lib} DEPDEP_INDEX)
+ if (DEPDEP_INDEX EQUAL -1)
+ list(APPEND THIS_TEST_DEPENDS_ALL ${additional_lib})
+ set(ADDED_DEPS TRUE)
+ endif()
+ string(TOUPPER "BOOST_${additional_lib}_DEPENDS" THIS_PROJECT_DEPENDS)
+ set(ADDED_DEPS TRUE)
+ while (ADDED_DEPS)
+ set(ADDED_DEPS FALSE)
+ foreach(DEP ${THIS_TEST_DEPENDS_ALL})
+ string(TOUPPER "BOOST_${DEP}_DEPENDS" DEP_DEPENDS)
+ foreach(DEPDEP ${${DEP_DEPENDS}})
+ list(FIND THIS_TEST_DEPENDS_ALL ${DEPDEP} DEPDEP_INDEX)
+ if (DEPDEP_INDEX EQUAL -1)
+ list(APPEND THIS_TEST_DEPENDS_ALL ${DEPDEP})
+ set(ADDED_DEPS TRUE)
+ endif()
+ endforeach()
+ endforeach()
+ endwhile()
+ endforeach()
+
+ foreach (include ${THIS_TEST_DEPENDS_ALL})
+ include_directories("${Boost_SOURCE_DIR}/libs/${include}/include")
+ endforeach (include ${includes})
+
+endmacro(boost_additional_test_dependencies libname)
+#-------------------------------------------------------------------------------
 
+#-------------------------------------------------------------------------------
 # This macro is an internal utility macro that helps parse the
 # arguments passed to the Boost testing commands. It will generally
 # not be used by Boost developers.
@@ -112,7 +180,7 @@
   set(BOOST_TEST_OKAY TRUE)
   set(BOOST_TEST_COMPILE_FLAGS "")
   parse_arguments(BOOST_TEST
- "LINK_LIBS;LINK_FLAGS;DEPENDS;COMPILE_FLAGS;ARGS;EXTRA_OPTIONS"
+ "BOOST_LIB;LINK_LIBS;LINK_FLAGS;DEPENDS;COMPILE_FLAGS;ARGS;EXTRA_OPTIONS"
     "COMPILE;RUN;LINK;FAIL;RELEASE;DEBUG"
     ${ARGN}
     )
@@ -216,7 +284,7 @@
 # boost_test_run(signal_test DEPENDS boost_signals)
 macro(boost_test_run testname)
   boost_test_parse_args(${testname} ${ARGN} RUN)
- if (BOOST_TEST_OKAY)
+ if (BOOST_TEST_OKAY)
     boost_add_executable(${testname} ${BOOST_TEST_SOURCES}
       OUTPUT_NAME tests/${PROJECT_NAME}/${testname}
       DEPENDS "${BOOST_TEST_DEPENDS}"
@@ -243,7 +311,7 @@
                         ${THIS_TEST_PREFIX_ARGS}
                         ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/tests/${PROJECT_NAME}/${testname}
                         ${BOOST_TEST_ARGS}
- COMMENT "Running ${testname} in project ${PROJECT_NAME}"
+ COMMENT "${PROJECT_NAME} => Running '${testname}'"
                         )
 
       add_dependencies(${BOOST_TEST_TESTNAME}
@@ -288,8 +356,12 @@
 macro(boost_test_compile testname)
   boost_test_parse_args(${testname} ${ARGN} COMPILE)
 
-
+ set (test_pass "PASSED")
+ if (BOOST_TEST_FAIL)
+ set (test_pass "FAILED")
+ endif(BOOST_TEST_FAIL)
   if (BOOST_TEST_OKAY)
+
     # Determine the include directories to pass along to the underlying
     # project.
     # works but not great
@@ -313,7 +385,7 @@
       -o ${CMAKE_CURRENT_BINARY_DIR}/${BOOST_TEST_TESTNAME}${CMAKE_CXX_OUTPUT_EXTENSION}
       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
       DEPENDS ${BOOST_TEST_SOURCES}
- COMMENT "Running ${testname} in project ${PROJECT_NAME}"
+ COMMENT "${PROJECT_NAME} => Running Compile ${test_pass} Test '${BOOST_TEST_SOURCES}'"
       )
 
     add_custom_target(${BOOST_TEST_TESTNAME}
@@ -356,7 +428,7 @@
     #
     add_custom_target(TARGET ${BOOST_TEST_TESTNAME}
       COMMAND /link/tests/are/failing/at/the/moment
- COMMENT "Link test ${testname} in ${PROJECT_NAME} is failing."
+ COMMENT "${PROJECT_NAME} => Link test '${testname}' is failing."
       )
 
     # POST_BUILD


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