mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 10:31:34 +08:00
Merge branch 'godbyk-header-tests'
This commit is contained in:
commit
ae5518188f
@ -12,6 +12,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
add_library(spdlog INTERFACE)
|
add_library(spdlog INTERFACE)
|
||||||
|
|
||||||
option(SPDLOG_BUILD_EXAMPLES "Build examples" OFF)
|
option(SPDLOG_BUILD_EXAMPLES "Build examples" OFF)
|
||||||
|
option(SPDLOG_BUILD_TESTS "Build tests" OFF)
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
spdlog
|
spdlog
|
||||||
@ -20,11 +21,17 @@ target_include_directories(
|
|||||||
"$<INSTALL_INTERFACE:include>"
|
"$<INSTALL_INTERFACE:include>"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(HEADER_BASE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||||
|
|
||||||
|
include(CTest)
|
||||||
if(SPDLOG_BUILD_EXAMPLES)
|
if(SPDLOG_BUILD_EXAMPLES)
|
||||||
enable_testing()
|
|
||||||
add_subdirectory(example)
|
add_subdirectory(example)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(SPDLOG_BUILD_TESTS)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
endif()
|
||||||
|
|
||||||
### Install ###
|
### Install ###
|
||||||
# * https://github.com/forexample/package-example
|
# * https://github.com/forexample/package-example
|
||||||
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <spdlog/details/null_mutex.h>
|
#include <spdlog/details/null_mutex.h>
|
||||||
|
#include <spdlog/sinks/base_sink.h>
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
24
tests/CMakeLists.txt
Normal file
24
tests/CMakeLists.txt
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#
|
||||||
|
# Tests
|
||||||
|
#
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
|
# Build Catch unit tests
|
||||||
|
add_library(catch INTERFACE)
|
||||||
|
target_include_directories(catch INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
file(GLOB catch_tests LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
|
||||||
|
|
||||||
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
set ( CMAKE_CXX_FLAGS "--std=c++11 -pthread")
|
||||||
|
set ( CMAKE_EXE_LIKKER_FLAGS "-pthread")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
add_executable(catch_tests ${catch_tests})
|
||||||
|
target_link_libraries(catch_tests spdlog)
|
||||||
|
add_test(NAME catch_tests COMMAND catch_tests)
|
||||||
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user