2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 01:12:13 +00:00

Fix link and link-fail tests in CMake.

Statechart's examples depend on numeric.


[SVN r52895]
This commit is contained in:
Douglas Gregor
2009-05-11 04:50:32 +00:00
parent 050920b612
commit dc6bfcf230
3 changed files with 23 additions and 12 deletions

View File

@@ -326,6 +326,14 @@ macro(boost_library_project LIBNAME)
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 @@ macro(boost_add_library LIBNAME)
)
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 @@ macro(boost_add_single_library LIBNAME)
)
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 @@ macro(boost_add_executable EXENAME)
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()

View File

@@ -282,6 +282,10 @@ macro(boost_test_run testname)
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 @@ endmacro(boost_test_compile_fail)
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 @@ macro(boost_test_link testname)
--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}"

View File

@@ -2,6 +2,6 @@ cmake_minimum_required(VERSION 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}")