From c99ba70b7d3386a30e1ef680a309d2a06a0f5f38 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 8 May 2019 10:53:12 +0100 Subject: [PATCH] update submod to latest --- CMakeLists.txt | 17 +++++++++++++---- Testing/CMakeLists.txt | 12 ++++++++++-- Testing/helper | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c476ed..c9f62bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,13 @@ set(CMAKE_CXX_STANDARD 14) project(cmake_example CXX) +# turns out that g++ will allow variable length arrays but I +# dont' want students getting dependant on non-standard features +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wvla -Werror=vla") + +# limit number of errors shown to 1 +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wfatal-errors") + # location of source code files include_directories(${CMAKE_SOURCE_DIR}) @@ -14,12 +21,14 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin ) file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib) +# add tests +enable_testing() +add_subdirectory(Testing) +add_subdirectory(Lecture) + add_library( print_two print_two.cpp ) add_executable( main main.cpp ) target_link_libraries( main print_two ) -# add tests -enable_testing() -add_subdirectory(Testing) -add_subdirectory(Lecture) + diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt index aaf1990..ace9b50 100644 --- a/Testing/CMakeLists.txt +++ b/Testing/CMakeLists.txt @@ -4,12 +4,12 @@ file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin ) # tell cmake where to find the catch2 library -set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/catch) +set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/helper/catch) add_library(Catch INTERFACE) target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR}) # tell cmake where to find the captureio library -set(CAPIO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/captureio) +set(CAPIO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/helper/captureio) add_library(Capio INTERFACE) target_include_directories(Capio INTERFACE ${CAPIO_INCLUDE_DIR}) @@ -33,3 +33,11 @@ foreach(filename ${files}) COMMAND ${TEST_RUNNER} ) endforeach() +file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/test_*.py") +foreach(filename ${files}) + # if test file is "test_thingy.py" then created test will be called "test_thingy" + get_filename_component(THIS_TEST ${filename} NAME_WE) + set(TEST_RUNNER ${THIS_TEST}) + + add_test(${THIS_TEST} "python3" ${filename}) +endforeach() diff --git a/Testing/helper b/Testing/helper index 4de251a..8be5d25 160000 --- a/Testing/helper +++ b/Testing/helper @@ -1 +1 @@ -Subproject commit 4de251a56a11335e5cb3c11ebc5d2790353b2548 +Subproject commit 8be5d257d40a3cc7ea12cc2950a1bf3c6ca4c749