mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-08 15:19:54 +01:00
Port the last example
This commit is contained in:
parent
70ef2f7f12
commit
29b441949c
@ -34,7 +34,8 @@ set(SELF_TEST_DIR ${CATCH_DIR}/tests/SelfTest)
|
|||||||
set(BENCHMARK_DIR ${CATCH_DIR}/tests/Benchmark)
|
set(BENCHMARK_DIR ${CATCH_DIR}/tests/Benchmark)
|
||||||
set(EXAMPLES_DIR ${CATCH_DIR}/examples)
|
set(EXAMPLES_DIR ${CATCH_DIR}/examples)
|
||||||
|
|
||||||
add_subdirectory(src)
|
# We need to bring-in the variables defined there to this scope
|
||||||
|
include(src/CMakeLists.txt)
|
||||||
|
|
||||||
# Build tests only if requested
|
# Build tests only if requested
|
||||||
if (BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)
|
if (BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)
|
||||||
|
@ -6,10 +6,12 @@
|
|||||||
// there is no important difference between having `std::cerr` buffered
|
// there is no important difference between having `std::cerr` buffered
|
||||||
// or unbuffered.
|
// or unbuffered.
|
||||||
|
|
||||||
#define CATCH_CONFIG_NOSTDOUT
|
#include <catch2/catch_default_main.hpp>
|
||||||
#define CATCH_CONFIG_MAIN
|
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
class out_buff : public std::stringbuf {
|
class out_buff : public std::stringbuf {
|
||||||
std::FILE* m_stream;
|
std::FILE* m_stream;
|
||||||
|
@ -17,8 +17,11 @@ add_executable( 020-MultiFile
|
|||||||
020-TestCase-2.cpp
|
020-TestCase-2.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: How to handle differently configured libraries?
|
add_executable(231-Cfg_OutputStreams
|
||||||
# Needed in 231-Cfg-OutputStreams
|
231-Cfg-OutputStreams.cpp
|
||||||
|
)
|
||||||
|
StampOutLibrary(231-Cfg_OutputStreams)
|
||||||
|
target_compile_definitions(Catch2_231-Cfg_OutputStreams PUBLIC CATCH_CONFIG_NOSTDOUT)
|
||||||
|
|
||||||
# These examples use the standard separate compilation
|
# These examples use the standard separate compilation
|
||||||
set( SOURCES_IDIOMATIC_EXAMPLES
|
set( SOURCES_IDIOMATIC_EXAMPLES
|
||||||
|
@ -229,3 +229,20 @@ target_include_directories(Catch2
|
|||||||
$<BUILD_INTERFACE:${SOURCES_DIR}/..>
|
$<BUILD_INTERFACE:${SOURCES_DIR}/..>
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
function(StampOutLibrary target)
|
||||||
|
add_library(Catch2_${target} STATIC
|
||||||
|
${REPORTER_FILES}
|
||||||
|
${INTERNAL_FILES}
|
||||||
|
${BENCHMARK_HEADERS}
|
||||||
|
${BENCHMARK_SOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(Catch2_${target}
|
||||||
|
PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${SOURCES_DIR}/..>
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${target} Catch2_${target})
|
||||||
|
endfunction()
|
||||||
|
Loading…
Reference in New Issue
Block a user