Merge branch 'develop' into feature/cmake-test

This commit is contained in:
Peter Dimov
2018-09-28 15:24:09 +03:00
2 changed files with 9 additions and 49 deletions

View File

@@ -1,9 +1,7 @@
# Copyright 2018 Mike Dev
# Copyright 2018 Peter Dimov
#
# Distributed under the Boost Software License, Version 1.0.
#
# See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5)
@@ -24,34 +22,11 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
add_subdirectory(../config bin/config)
add_subdirectory(../core bin/core)
include(../mincmake/cmake/boost_test.cmake)
enable_testing()
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C ${CMAKE_CFG_INTDIR})
function(boost_test)
cmake_parse_arguments(_ "" "PREFIX;NAME" "SOURCES;LIBRARIES" ${ARGN})
if(NOT __PREFIX)
set(__PREFIX ${PROJECT_NAME})
endif()
if(NOT __NAME)
list(GET __SOURCES 0 __NAME)
string(MAKE_C_IDENTIFIER ${__NAME} __NAME)
endif()
set(__NAME ${__PREFIX}-${__NAME})
add_executable(${__NAME} EXCLUDE_FROM_ALL ${__SOURCES})
target_link_libraries(${__NAME} ${__LIBRARIES})
add_test(NAME compile-${__NAME} COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target ${__NAME})
add_test(NAME run-${__NAME} COMMAND ${__NAME})
set_tests_properties(run-${__NAME} PROPERTIES DEPENDS compile-${__NAME})
endfunction(boost_test)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
endif()

View File

@@ -1,23 +1,8 @@
# Copyright 2018 Peter Dimov
#
# Distributed under the Boost Software License, Version 1.0.
#
# See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
boost_test(SOURCES assert_test.cpp LIBRARIES Boost::assert Boost::core)
boost_test(SOURCES current_function_test.cpp LIBRARIES Boost::assert Boost::core)
boost_test(SOURCES verify_test.cpp LIBRARIES Boost::assert Boost::core)
boost_test(SOURCES assert_is_void_test.cpp LIBRARIES Boost::assert Boost::core)
boost_test_jamfile(FILE Jamfile.v2 LIBRARIES Boost::assert Boost::core)
# expansion tests are in exp/ so that there is a backslash in the path on Windows
boost_test(SOURCES exp/assert_exp_test.cpp LIBRARIES Boost::assert Boost::core)
boost_test(SOURCES exp/assert_msg_exp_test.cpp LIBRARIES Boost::assert Boost::core)
boost_test(SOURCES exp/verify_exp_test.cpp LIBRARIES Boost::assert Boost::core)
boost_test(SOURCES exp/verify_msg_exp_test.cpp LIBRARIES Boost::assert Boost::core)
boost_test(SOURCES assert_test2.cpp LIBRARIES Boost::assert Boost::core)
boost_test(SOURCES assert_msg_test2.cpp LIBRARIES Boost::assert Boost::core)
boost_test(SOURCES quick.cpp LIBRARIES Boost::assert Boost::core)
# This one doesn't import
boost_test(TYPE run SOURCES current_function_test.cpp LIBRARIES Boost::assert Boost::core)