Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include(FetchContent)
- #=====================================
- # Helper functions and macros
- #=====================================
- # Supresses all messages
- function(message)
- if (NOT MESSAGE_QUIET)
- _message(${ARGN})
- endif()
- endfunction()
- # Adds external dependency into a project
- # If FETCHCONTENT_QUIET is true, does it quietly (e.g. without telling that X feature is found)
- function(add_external_dependency dependency)
- if (FETCHCONTENT_QUIET)
- set(MESSAGE_QUIET ON)
- endif()
- add_subdirectory(${${dependency}_SOURCE_DIR} ${${dependency}_BINARY_DIR})
- if (FETCHCONTENT_QUIET)
- set(MESSAGE_QUIET OFF)
- endif()
- endfunction()
- #=====================================
- # Options and initial settings
- #=====================================
- message(STATUS "Fetching third party libraries")
- option(USE_SYSTEM_DEPS CACHE ON)
- option(LINK_DEPS_STATIC CACHE ON)
- if (NOT LINK_DEPS_STATIC)
- set(BUILD_SHARED_LIBS ON)
- endif()
- #=====================================
- # Versions of external libs
- #=====================================
- set(NLOHMANN_JSON_VERSION 3.1.2)
- set(SFML_VERSION 2.5.0)
- set(FMT_VERSION 5.1.0)
- set(SOL2_VERSION 2.20.4)
- set(IMGUI_VERSION 1.62)
- set(IMGUI_SFML_VERSION 1.0)
- set(LUA_VERSION 5.2.4)
- #=====================================
- # FetchContent declarations
- #=====================================
- FetchContent_Declare(
- nlohmann_json
- URL "https://github.com/nlohmann/json/releases/download/v${NLOHMANN_JSON_VERSION}/include.zip"
- )
- FetchContent_Declare(
- SFML
- URL "https://github.com/SFML/SFML/archive/${SFML_VERSION}.zip"
- )
- FetchContent_Declare(
- fmt
- URL "https://github.com/fmtlib/fmt/releases/download/${FMT_VERSION}/fmt-${FMT_VERSION}.zip"
- )
- FetchContent_Declare(
- sol2
- URL "https://github.com/ThePhD/sol2/archive/v${SOL2_VERSION}.zip"
- )
- FetchContent_Declare(
- imgui
- URL "https://github.com/ocornut/imgui/archive/v${IMGUI_VERSION}.zip"
- )
- FetchContent_Declare(
- imgui-sfml
- GIT_REPOSITORY https://github.com/eliasdaler/imgui-sfml.git
- GIT_TAG modern-cmake
- )
- FetchContent_Declare(
- metastuff
- GIT_REPOSITORY https://github.com/eliasdaler/MetaStuff
- GIT_TAG cmake
- )
- FetchContent_Declare(
- googletest
- GIT_REPOSITORY https://github.com/google/googletest
- GIT_TAG 735bd75f69f8a1c6240c95915edfa091bfa976ac
- )
- #=====================================
- add_subdirectory(googletest)
- add_subdirectory(sfml)
- add_subdirectory(imgui)
- add_subdirectory(imgui-sfml)
- add_subdirectory(lua)
- add_subdirectory(sol2)
- # header only libs
- add_subdirectory(fmt)
- add_subdirectory(metastuff)
- add_subdirectory(nlohmann_json)
- #=====================================
- message(STATUS "Fetching thirdparty libraries done")
Advertisement
Add Comment
Please, Sign In to add comment