Use mincmake

This commit is contained in:
Peter Dimov
2018-09-20 17:47:40 +03:00
parent a26be1fb2f
commit a454453443
2 changed files with 5 additions and 40 deletions

View File

@@ -22,35 +22,12 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
add_subdirectory(../config bin/config) add_subdirectory(../config bin/config)
add_subdirectory(../core bin/core) add_subdirectory(../core bin/core)
include(../mincmake/cmake/boost_test.cmake)
enable_testing() enable_testing()
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>) add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
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)
endif() endif()
if(COMMAND boost_test) if(COMMAND boost_test)

View File

@@ -2,19 +2,7 @@
# Distributed under the Boost Software License, Version 1.0. # 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_jamfile(FILE Jamfile.v2 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)
# expansion tests are in exp/ so that there is a backslash in the path on Windows # This one doesn't import
boost_test(TYPE run SOURCES current_function_test.cpp LIBRARIES Boost::assert Boost::core)
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)