From d587bdf60a4cce6c4b691c76c542024c5b3a3736 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 5 Apr 2024 19:41:10 +0200 Subject: Push contrib variables to cache and reshuffle them --- CMakeLists.txt | 2 +- contrib/CMakeLists.txt | 27 +++++++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fee45df..8f7a701 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,13 +7,13 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") set(STEAM_APPID $ENV{STEAM_APPID} CACHE STRING "App ID for steam deployment") set(STEAM_DEPOTID_WINDOWS $ENV{STEAM_DEPOTID_WINDOWS} CACHE STRING "Steam Depot ID for Windows builds") set(STEAM_DEPOTID_LINUX $ENV{STEAM_DEPOTID_LINUX} CACHE STRING "Steam Depot ID for Linux builds") -set(CMAKE_INSTALL_BINDIR .) enable_testing() include(AddResources) include(AddVersionFile) include(FetchContent) include(GoogleTest) add_subdirectory(contrib) # Out of order to handle dependencies. +set(CMAKE_INSTALL_BINDIR .) add_subdirectory(campaign) add_subdirectory(engine) add_subdirectory(kurator) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index faee8bf..19efd3a 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -1,9 +1,15 @@ -set(BUILD_SHARED_LIBS No) -set(BUILD_GMOCK No) -set(INSTALL_GTEST No) -set(USE_EXTERNAL_GLFW Off) -set(OpenGL_GL_PREFERENCE GLVND) add_subdirectory(imgui) +function(MakeAvailable DEPNAME) + string(TOLOWER "${DEPNAME}" DEPNAME) + FetchContent_GetProperties(${DEPNAME}) + if(NOT ${DEPNAME}_POPULATED) + FetchContent_Populate(${DEPNAME}) + add_subdirectory(${${DEPNAME}_SOURCE_DIR} ${${DEPNAME}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() +endfunction() +set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "") +set(ENTT_USE_LIBCPP OFF CACHE INTERNAL "") +set(ENTT_BUILD_TESTING OFF CACHE INTERNAL "") FetchContent_Declare( EnTT GIT_REPOSITORY https://github.com/skypjack/entt.git @@ -11,6 +17,8 @@ FetchContent_Declare( GIT_SHALLOW Yes OVERRIDE_FIND_PACKAGE ) +set(BUILD_GMOCK OFF CACHE INTERNAL "") +set(INSTALL_GTEST OFF CACHE INTERNAL "") FetchContent_Declare( GTest GIT_REPOSITORY https://github.com/google/googletest.git @@ -18,6 +26,7 @@ FetchContent_Declare( GIT_SHALLOW Yes OVERRIDE_FIND_PACKAGE ) +set(JSON_MultipleHeaders ON CACHE INTERNAL "") FetchContent_Declare( nlohmann_json GIT_REPOSITORY https://github.com/nlohmann/json.git @@ -25,6 +34,9 @@ FetchContent_Declare( GIT_SHALLOW Yes OVERRIDE_FIND_PACKAGE ) +set(CMAKE_BUILD_TYPE Release CACHE INTERNAL "") +set(OpenGL_GL_PREFERENCE GLVND CACHE INTERNAL "") +set(USE_EXTERNAL_GLFW OFF CACHE INTERNAL "") FetchContent_Declare( raylib GIT_REPOSITORY https://github.com/raysan5/raylib.git @@ -32,4 +44,7 @@ FetchContent_Declare( GIT_SHALLOW Yes OVERRIDE_FIND_PACKAGE ) -FetchContent_MakeAvailable(EnTT GTest nlohmann_json raylib) +find_package(EnTT REQUIRED 3) +find_package(GTest REQUIRED 1) +find_package(nlohmann_json REQUIRED 3) +find_package(raylib REQUIRED 4) -- cgit v1.1