From 3a44818b2af2ddea564cc031c83574113ad7344c Mon Sep 17 00:00:00 2001 From: gabime Date: Sat, 18 Jun 2016 15:04:08 +0300 Subject: [PATCH] fixed pr #228 to include pthread and removed header_dependecies test --- tests/CMakeLists.txt | 9 +++- tests/header_dependencies/CMakeLists.txt | 58 ------------------------ tests/header_dependencies/main.c | 7 --- tests/header_dependencies/main.cpp | 4 -- 4 files changed, 7 insertions(+), 71 deletions(-) delete mode 100644 tests/header_dependencies/CMakeLists.txt delete mode 100644 tests/header_dependencies/main.c delete mode 100644 tests/header_dependencies/main.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 307ddeb6..185fb082 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -9,11 +9,16 @@ 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") -# Ensure headers include their own dependencies -add_subdirectory(header_dependencies) + diff --git a/tests/header_dependencies/CMakeLists.txt b/tests/header_dependencies/CMakeLists.txt deleted file mode 100644 index 81779694..00000000 --- a/tests/header_dependencies/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -# -# Ensure all headers include all dependencies -# - -set(IGNORED_HEADERS "") - -set(COMMON_TEST_LIBRARIES spdlog) - -add_custom_target(header_dependencies) - -file(GLOB_RECURSE headers RELATIVE "${HEADER_BASE}" ${HEADER_BASE}/*.h) -set(test_index 0) -foreach(HEADER ${headers}) - # Sample of relevant variables computed here - # HEADER: details/line_logger_impl.h - # symbolname: spdlog_details_line_logger_impl - - # Compute symbolname - string(REPLACE ".h" "" symbolname "${HEADER}") - string(MAKE_C_IDENTIFIER "${symbolname}" symbolname) - - list(FIND IGNORED_HEADERS "${HEADER}" _index) - # If we didn't explicitly ignore this and if we built this target - if(${_index} EQUAL -1) - #message(STATUS "${HEADER}: '${symbolname}'") - - set(extension cpp) - - # Name the test and output file with a number, to dodge Windows path length limits. - # Call it header, instead of test, to avoid polluting the 'executable namespace' - set(test_name "header_${extension}_${test_index}") - - set(source_file "${CMAKE_CURRENT_SOURCE_DIR}/main.${extension}") - - add_executable(${test_name} "${source_file}") - target_compile_definitions(${test_name} PRIVATE HEADER_TO_TEST="${HEADER}") - target_include_directories(${test_name} - PRIVATE - ${BUILDTREE_HEADER_BASE} - ${HEADER_BASE}) - - set_target_properties(${test_name} PROPERTIES - FOLDER "Header dependency tests") - - target_link_libraries(${test_name} - PRIVATE - ${COMMON_TEST_LIBRARIES} - ${LIBRARIES_${symbolname}} - ${LIBRARIES_${libname}}) - - add_test(NAME ${test_name}_builds COMMAND ${test_name}) - add_dependencies(header_dependencies ${test_name}) - - math(EXPR test_index "${test_index} + 1") - endif() -endforeach() - - diff --git a/tests/header_dependencies/main.c b/tests/header_dependencies/main.c deleted file mode 100644 index d2b5af77..00000000 --- a/tests/header_dependencies/main.c +++ /dev/null @@ -1,7 +0,0 @@ - -#include HEADER_TO_TEST - -int main(int argc, char** argv) -{ - return 0; -} diff --git a/tests/header_dependencies/main.cpp b/tests/header_dependencies/main.cpp deleted file mode 100644 index 7716c88b..00000000 --- a/tests/header_dependencies/main.cpp +++ /dev/null @@ -1,4 +0,0 @@ - -#include HEADER_TO_TEST - -int main(int argc, char *argv[]) { return 0; }