Created
November 8, 2017 00:46
-
-
Save hmenke/cebf23b56b3f11b07a1b825558eab4b1 to your computer and use it in GitHub Desktop.
Boost.Test on AppVeyor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
platform: | |
- x64 | |
environment: | |
GENERATOR: "Visual Studio 14 2015 Win64" | |
CONFIG: Debug | |
BOOST_ROOT: "C:\\Libraries\\boost_1_59_0" | |
BOOST_LIBRARYDIR: "C:\\Libraries\\boost_1_59_0\\lib64-msvc-14.0" | |
PATH: "%BOOST_LIBRARYDIR%;%PATH%" | |
build_script: | |
- echo "%PATH%" | |
- mkdir build | |
- cd build | |
- cmake -G "%GENERATOR%" -DCMAKE_BUILD_TYPE="%CONFIG%" -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" .. | |
- cmake --build . --config "%CONFIG%" | |
test_script: | |
- cmake --build . --target check --config "%CONFIG%" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.1 FATAL_ERROR) | |
project(msvc_boost_test CXX) | |
set(CMAKE_CXX_STANDARD 11) | |
if(NOT CMAKE_BUILD_TYPE) | |
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the build type" FORCE) | |
endif(NOT CMAKE_BUILD_TYPE) | |
enable_testing() | |
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C ${CMAKE_BUILD_TYPE}) | |
find_package(Boost REQUIRED COMPONENTS unit_test_framework) | |
include_directories(${Boost_INCLUDE_DIRS}) | |
function(UNIT_TEST) | |
# Parse arguments | |
cmake_parse_arguments(UT "" "TARGET" "SOURCE" ${ARGN}) | |
# Add target for test and link with libraries | |
add_executable(${UT_TARGET} ${UT_SOURCE}) | |
target_link_libraries(${UT_TARGET} ${LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) | |
add_test(NAME ${UT_TARGET} COMMAND ${UT_TARGET}) | |
add_dependencies(check ${UT_TARGET}) | |
endfunction(UNIT_TEST) | |
unit_test(TARGET target_boost_test SOURCE target_boost_test.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define BOOST_TEST_MODULE target_boost_test | |
#define BOOST_TEST_DYN_LINK | |
#include <boost/test/unit_test.hpp> | |
BOOST_AUTO_TEST_CASE(testcase) | |
{ | |
BOOST_CHECK(true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment