diff --git a/CMakeLists.txt b/CMakeLists.txt index 953d48c..c3cea6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,23 +32,38 @@ else() set(WITH_COVERAGE NO) endif() -if (NOT TARGET sfl) - FetchContent_Declare(sfl - GIT_REPOSITORY "https://github.com/slavenf/sfl-library.git" - GIT_TAG "master" - GIT_SHALLOW ON) - FetchContent_MakeAvailable(sfl) -endif() - -if (NOT TARGET stx) - FetchContent_Declare(stx - GIT_REPOSITORY "https://github.com/Klebert-Engineering/stx.git" - GIT_TAG "main" - GIT_SHALLOW ON) - FetchContent_MakeAvailable(stx) -endif() - -find_package(Bitsery REQUIRED) +FetchContent_Declare(sfl + GIT_REPOSITORY "https://github.com/slavenf/sfl-library.git" + GIT_TAG "master" + GIT_SHALLOW ON + FIND_PACKAGE_ARGS) +FetchContent_MakeAvailable(sfl) + +FetchContent_Declare(stx + GIT_REPOSITORY "https://github.com/Klebert-Engineering/stx.git" + GIT_TAG "main" + GIT_SHALLOW ON + FIND_PACKAGE_ARGS) + +FetchContent_Declare(Bitsery + GIT_REPOSITORY "https://github.com/fraillt/bitsery.git" + GIT_TAG "v5.2.3" + GIT_SHALLOW ON + FIND_PACKAGE_ARGS) + +FetchContent_Declare(nlohmann_json + GIT_REPOSITORY "https://github.com/nlohmann/json.git" + GIT_TAG "v3.11.2" + GIT_SHALLOW ON + FIND_PACKAGE_ARGS) + +FetchContent_Declare(Catch2 + GIT_REPOSITORY "https://github.com/catchorg/Catch2.git" + GIT_TAG "v3.5.2" + GIT_SHALLOW ON + FIND_PACKAGE_ARGS) + +FetchContent_MakeAvailable(sfl stx Bitsery) if (NOT DEFINED SIMFIL_WITH_MODEL_JSON) set(SIMFIL_WITH_MODEL_JSON YES) @@ -117,7 +132,7 @@ if (MSVC) endif() if (SIMFIL_WITH_MODEL_JSON) - find_package(nlohmann_json REQUIRED) + FetchContent_MakeAvailable(nlohmann_json) target_compile_definitions(simfil PUBLIC diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 68c6068..2088103 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,7 +1,8 @@ project(test.simfil) set(CMAKE_CXX_STANDARD 17) # Required for catch2 -find_package(Catch2 REQUIRED) + +FetchContent_MakeAvailable(Catch2) add_executable(test.simfil token.cpp