diff --git a/CMakeLists.txt b/CMakeLists.txt index d026d2ea..3a2bf775 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,12 @@ else() set(CCR_EXCLUDE_FROM_ALL "EXCLUDE_FROM_ALL") endif() +option( + CCR_FETCH_DEPS + "Fetch dependencies via FetchContent." + On +) + option(CCR_BUILD_TESTS "Enable building the tests" ${CCR_DEFAULTOPT}) if (CCR_BUILD_TESTS) @@ -38,5 +44,15 @@ include(GNUInstallDirs) include(CTest) include(GoogleTest) -add_subdirectory(external) +if (CCR_FETCH_DEPS) + add_subdirectory(external) +else() + find_package(CLI11 REQUIRED) + find_package(nlohmann_json REQUIRED) + find_package(GTest REQUIRED) + find_package(pugixml REQUIRED) + find_package(cucumber_messages REQUIRED) + find_package(cucumber_gherkin REQUIRED) +endif() + add_subdirectory(cucumber_cpp) diff --git a/cucumber_cpp/library/CMakeLists.txt b/cucumber_cpp/library/CMakeLists.txt index 7a86b415..71cb59bd 100644 --- a/cucumber_cpp/library/CMakeLists.txt +++ b/cucumber_cpp/library/CMakeLists.txt @@ -29,8 +29,8 @@ target_include_directories(cucumber_cpp.library PUBLIC ) target_link_libraries(cucumber_cpp.library PUBLIC - gtest - gmock + GTest::gtest + GTest::gmock cucumber_gherkin_lib cucumber_cpp.library.report cucumber_cpp.library.engine diff --git a/cucumber_cpp/library/report/CMakeLists.txt b/cucumber_cpp/library/report/CMakeLists.txt index ca8ac748..167fae75 100644 --- a/cucumber_cpp/library/report/CMakeLists.txt +++ b/cucumber_cpp/library/report/CMakeLists.txt @@ -14,6 +14,6 @@ target_include_directories(cucumber_cpp.library.report PUBLIC ) target_link_libraries(cucumber_cpp.library.report PUBLIC - pugixml + pugixml::pugixml cucumber_cpp.library ) diff --git a/cucumber_cpp/library/test/CMakeLists.txt b/cucumber_cpp/library/test/CMakeLists.txt index 650d01c1..998d657a 100644 --- a/cucumber_cpp/library/test/CMakeLists.txt +++ b/cucumber_cpp/library/test/CMakeLists.txt @@ -3,9 +3,9 @@ add_test(NAME cucumber_cpp.library.test COMMAND cucumber_cpp.library.test) target_link_libraries(cucumber_cpp.library.test PUBLIC cucumber_cpp.library - gtest - gmock - gmock_main + GTest::gtest + GTest::gmock + GTest::gmock_main cucumber_cpp.library.engine.test_helper cucumber_cpp.library.engine.test_helper.steps )