Skip to content

Commit

Permalink
unittest: make use of precompiled headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-schlecker committed Jun 28, 2022
1 parent fa5022f commit f3b4c64
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#####################################
# Define Project-Wide Settings
#####################################
cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR)

# Define the project name and language
project(Crow
Expand Down Expand Up @@ -92,7 +92,7 @@ if(CROW_BUILD_EXAMPLES)
endif()

# Tests
if(NOT MSVC AND CROW_BUILD_TESTS)
if(CROW_BUILD_TESTS)
if(NOT "compression" IN_LIST CROW_FEATURES)
message(STATUS "Compression tests are omitted. (Configure with CROW_FEATURES containing 'compression' to enable them)")
endif()
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.16)
project(crow_examples)

include(${CMAKE_SOURCE_DIR}/cmake/compiler_options.cmake)
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.16)
project(crow_test)

add_subdirectory(unittest)
Expand Down
2 changes: 1 addition & 1 deletion tests/img/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.16)

file(COPY . DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
2 changes: 1 addition & 1 deletion tests/template/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.16)
project(template_test)

set(PROJECT_INCLUDE_DIR
Expand Down
8 changes: 7 additions & 1 deletion tests/unittest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.16)
project(crow_test)

include(${CMAKE_SOURCE_DIR}/cmake/compiler_options.cmake)
Expand Down Expand Up @@ -31,7 +31,13 @@ endif()
add_executable(unittest ${TEST_SRCS})
target_include_directories(unittest PRIVATE include)
target_link_libraries(unittest Crow::Crow)
target_precompile_headers(unittest PRIVATE include/catch.hpp)
add_warnings_optimizations(unittest)
set_source_files_properties(src/catch.cpp
PROPERTIES
SKIP_PRECOMPILE_HEADERS ON
)


if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set_target_properties(unittest PROPERTIES COMPILE_FLAGS "--coverage -fprofile-arcs -ftest-coverage")
Expand Down
1 change: 0 additions & 1 deletion tests/unittest/include/unittest.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#define CROW_LOG_LEVEL 0
#define LOCALHOST_ADDRESS "127.0.0.1"

#include "catch.hpp"
#include "crow.h"

using namespace std;
Expand Down

0 comments on commit f3b4c64

Please sign in to comment.