diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fa01bee8..547a5078 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -37,14 +37,41 @@ if(TARGET Qt5::Test) list(APPEND CUKE_EXTRA_PRIVATE_LIBRARIES Qt5::Test) endif() -if(CMAKE_EXTRA_GENERATOR OR MSVC_IDE) - message(STATUS "Adding header files to project") - file(GLOB_RECURSE CUKE_HEADERS "${CUKE_INCLUDE_DIR}/cucumber-cpp/*.hpp") - if(MSVC_IDE) - source_group("Header Files" FILES ${CUKE_HEADERS}) - endif() - list(APPEND CUKE_SOURCES ${CUKE_HEADERS}) +message(STATUS "Adding header files to project") +set(CUKE_HEADERS + ../include/cucumber-cpp/autodetect.hpp + ../include/cucumber-cpp/defs.hpp + ../include/cucumber-cpp/generic.hpp + ../include/cucumber-cpp/internal/ContextManager.hpp + ../include/cucumber-cpp/internal/CukeCommands.hpp + ../include/cucumber-cpp/internal/CukeEngine.hpp + ../include/cucumber-cpp/internal/CukeEngineImpl.hpp + ../include/cucumber-cpp/internal/Macros.hpp + ../include/cucumber-cpp/internal/RegistrationMacros.hpp + ../include/cucumber-cpp/internal/Scenario.hpp + ../include/cucumber-cpp/internal/Table.hpp + ../include/cucumber-cpp/internal/connectors/wire/ProtocolHandler.hpp + ../include/cucumber-cpp/internal/connectors/wire/WireProtocol.hpp + ../include/cucumber-cpp/internal/connectors/wire/WireProtocolCommands.hpp + ../include/cucumber-cpp/internal/connectors/wire/WireServer.hpp + ../include/cucumber-cpp/internal/defs.hpp + ../include/cucumber-cpp/internal/drivers/BoostDriver.hpp + ../include/cucumber-cpp/internal/drivers/DriverSelector.hpp + ../include/cucumber-cpp/internal/drivers/GTestDriver.hpp + ../include/cucumber-cpp/internal/drivers/GenericDriver.hpp + ../include/cucumber-cpp/internal/drivers/QtTestDriver.hpp + ../include/cucumber-cpp/internal/hook/HookMacros.hpp + ../include/cucumber-cpp/internal/hook/HookRegistrar.hpp + ../include/cucumber-cpp/internal/hook/Tag.hpp + ../include/cucumber-cpp/internal/step/StepMacros.hpp + ../include/cucumber-cpp/internal/step/StepManager.hpp + ../include/cucumber-cpp/internal/utils/IndexSequence.hpp + ../include/cucumber-cpp/internal/utils/Regex.hpp +) +if(MSVC_IDE) + source_group("Header Files" FILES ${CUKE_HEADERS}) endif() +list(APPEND CUKE_SOURCES ${CUKE_HEADERS}) # Library for unit tests relying on internals add_library(cucumber-cpp-internal STATIC ${CUKE_SOURCES}) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f1335081..01019633 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,8 +1,19 @@ +add_library(utils INTERFACE + utils/HookRegistrationFixture.hpp + utils/ContextManagerTestDouble.hpp + utils/DriverTestRunner.hpp + utils/CukeCommandsFixture.hpp + utils/StepManagerTestDouble.hpp +) +target_include_directories(utils INTERFACE + . +) + function(cuke_add_driver_test TEST_FILE) get_filename_component(TEST_NAME ${TEST_FILE} NAME) message(STATUS "Adding " ${TEST_NAME}) add_executable(${TEST_NAME} ${TEST_FILE}.cpp) - target_link_libraries(${TEST_NAME} PRIVATE cucumber-cpp-internal ${ARGN}) + target_link_libraries(${TEST_NAME} PRIVATE cucumber-cpp-internal utils ${ARGN}) add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) endfunction() @@ -11,7 +22,7 @@ if(TARGET GMock::Main) get_filename_component(TEST_NAME ${TEST_FILE} NAME) message(STATUS "Adding " ${TEST_NAME}) add_executable(${TEST_NAME} ${TEST_FILE}.cpp) - target_link_libraries(${TEST_NAME} PRIVATE cucumber-cpp-internal ${ARGN} GMock::Main) + target_link_libraries(${TEST_NAME} PRIVATE cucumber-cpp-internal utils ${ARGN} GMock::Main) gtest_add_tests(${TEST_NAME} "" ${TEST_FILE}.cpp) # Run all tests in executable at once too. This ensures that the used fixtures get tested # properly too. Additionally gather the output in jUnit compatible output for CI. diff --git a/tests/integration/ContextHandlingTest.cpp b/tests/integration/ContextHandlingTest.cpp index 0627328e..647f7729 100644 --- a/tests/integration/ContextHandlingTest.cpp +++ b/tests/integration/ContextHandlingTest.cpp @@ -1,6 +1,6 @@ #include -#include "../utils/ContextManagerTestDouble.hpp" +#include "utils/ContextManagerTestDouble.hpp" using namespace std; using namespace cucumber::internal; diff --git a/tests/integration/HookRegistrationTest.cpp b/tests/integration/HookRegistrationTest.cpp index 380714c0..52e4cfe3 100644 --- a/tests/integration/HookRegistrationTest.cpp +++ b/tests/integration/HookRegistrationTest.cpp @@ -1,6 +1,6 @@ #include -#include "../utils/HookRegistrationFixture.hpp" +#include "utils/HookRegistrationFixture.hpp" #include diff --git a/tests/integration/TaggedHookRegistrationTest.cpp b/tests/integration/TaggedHookRegistrationTest.cpp index 193d5af5..542e2f86 100644 --- a/tests/integration/TaggedHookRegistrationTest.cpp +++ b/tests/integration/TaggedHookRegistrationTest.cpp @@ -1,6 +1,6 @@ #include -#include "../utils/HookRegistrationFixture.hpp" +#include "utils/HookRegistrationFixture.hpp" #include BEFORE("@a") { diff --git a/tests/integration/drivers/BoostDriverTest.cpp b/tests/integration/drivers/BoostDriverTest.cpp index 8f18e06f..676f5d30 100644 --- a/tests/integration/drivers/BoostDriverTest.cpp +++ b/tests/integration/drivers/BoostDriverTest.cpp @@ -2,7 +2,7 @@ #include #include -#include "../../utils/DriverTestRunner.hpp" +#include "utils/DriverTestRunner.hpp" using namespace cucumber; diff --git a/tests/integration/drivers/GTestDriverTest.cpp b/tests/integration/drivers/GTestDriverTest.cpp index b5d2e6c5..afd88a67 100644 --- a/tests/integration/drivers/GTestDriverTest.cpp +++ b/tests/integration/drivers/GTestDriverTest.cpp @@ -1,7 +1,7 @@ #include #include -#include "../../utils/DriverTestRunner.hpp" +#include "utils/DriverTestRunner.hpp" using namespace cucumber; diff --git a/tests/integration/drivers/GenericDriverTest.cpp b/tests/integration/drivers/GenericDriverTest.cpp index 1f8b0876..8e68eb5f 100644 --- a/tests/integration/drivers/GenericDriverTest.cpp +++ b/tests/integration/drivers/GenericDriverTest.cpp @@ -1,6 +1,6 @@ #include -#include "../../utils/DriverTestRunner.hpp" +#include "utils/DriverTestRunner.hpp" using namespace cucumber; diff --git a/tests/integration/drivers/QtTestDriverTest.cpp b/tests/integration/drivers/QtTestDriverTest.cpp index bbdc9406..5de2568e 100644 --- a/tests/integration/drivers/QtTestDriverTest.cpp +++ b/tests/integration/drivers/QtTestDriverTest.cpp @@ -1,7 +1,7 @@ #include #include -#include "../../utils/DriverTestRunner.hpp" +#include "utils/DriverTestRunner.hpp" using namespace cucumber; diff --git a/tests/unit/ContextManagerTest.cpp b/tests/unit/ContextManagerTest.cpp index 8d300321..0c7291ce 100644 --- a/tests/unit/ContextManagerTest.cpp +++ b/tests/unit/ContextManagerTest.cpp @@ -1,6 +1,6 @@ #include -#include "../utils/ContextManagerTestDouble.hpp" +#include "utils/ContextManagerTestDouble.hpp" #include diff --git a/tests/unit/CukeCommandsTest.cpp b/tests/unit/CukeCommandsTest.cpp index 4fb1d911..6449292d 100644 --- a/tests/unit/CukeCommandsTest.cpp +++ b/tests/unit/CukeCommandsTest.cpp @@ -1,7 +1,7 @@ #include #include -#include "../utils/CukeCommandsFixture.hpp" +#include "utils/CukeCommandsFixture.hpp" #include diff --git a/tests/unit/StepManagerTest.cpp b/tests/unit/StepManagerTest.cpp index 72c1eafb..bfb06f3c 100644 --- a/tests/unit/StepManagerTest.cpp +++ b/tests/unit/StepManagerTest.cpp @@ -1,6 +1,6 @@ #include -#include "../utils/StepManagerTestDouble.hpp" +#include "utils/StepManagerTestDouble.hpp" #include