From 5a906131eb10c8ece9af29569ab4a6836f11451a Mon Sep 17 00:00:00 2001 From: Quantum Date: Wed, 18 Aug 2021 18:02:33 -0400 Subject: [PATCH] [all] cmake: tell users to clone submodules when they haven't This gives users a command to run that will automagically fix the submodule situation, and should reduce the amount of support requests. --- client/CMakeLists.txt | 1 + cmake/CheckSubmodule.cmake | 8 ++++++++ host/CMakeLists.txt | 1 + obs/CMakeLists.txt | 1 + 4 files changed, 11 insertions(+) create mode 100644 cmake/CheckSubmodule.cmake diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 3f7c9ef2..b29aec99 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -4,6 +4,7 @@ project(looking-glass-client C CXX) get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE) list(APPEND CMAKE_MODULE_PATH "${PROJECT_TOP}/cmake/" "${PROJECT_SOURCE_DIR}/cmake/") +include(CheckSubmodule) include(GNUInstallDirs) include(CheckCCompilerFlag) include(FeatureSummary) diff --git a/cmake/CheckSubmodule.cmake b/cmake/CheckSubmodule.cmake new file mode 100644 index 00000000..75490b14 --- /dev/null +++ b/cmake/CheckSubmodule.cmake @@ -0,0 +1,8 @@ +if (EXISTS "${PROJECT_TOP}/.git" AND ( + (NOT EXISTS "${PROJECT_TOP}/repos/cimgui/.git") OR + (NOT EXISTS "${PROJECT_TOP}/repos/LGMP/.git") OR + (NOT EXISTS "${PROJECT_TOP}/repos/PureSpice/.git") OR + (NOT EXISTS "${PROJECT_TOP}/repos/cimgui/imgui/.git") +)) + message(FATAL_ERROR "Submodules are not initialized. Run\n\tgit submodule update --init --recursive") +endif() diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index bc6f2db6..ab1a2a6c 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -7,6 +7,7 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG" CACHE STRING "compiler flag get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE) list(APPEND CMAKE_MODULE_PATH "${PROJECT_TOP}/cmake/" "${PROJECT_SOURCE_DIR}/cmake/") +include(CheckSubmodule) include(GNUInstallDirs) include(CheckCCompilerFlag) include(FeatureSummary) diff --git a/obs/CMakeLists.txt b/obs/CMakeLists.txt index 1b740654..28feeeed 100644 --- a/obs/CMakeLists.txt +++ b/obs/CMakeLists.txt @@ -4,6 +4,7 @@ project(looking-glass-obs C) get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE) list(APPEND CMAKE_MODULE_PATH "${PROJECT_TOP}/cmake/" "${PROJECT_SOURCE_DIR}/cmake/") +include(CheckSubmodule) include(GNUInstallDirs) include(CheckCCompilerFlag) include(FeatureSummary)