From 7eda36bbf4e59bb5c62400ec6ad3c9d29cfa07f0 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Thu, 9 Nov 2023 20:52:57 -0700 Subject: [PATCH] CMake: Don't recursively include Ladybird/Lagom in buggy CMake versions Ran into this with the new EAP for CLion Nova. When using Ladybird as source directory, we would recursively look in Ladybird --> Lagom --> Ladybird when exporting components. This seems to be because ENABLE_LAGOM_LADYBIRD is set to ON by Ladybird's CMakeLists and something about their build, when invoked from their IDE, has buggy behavior around the SUBDIRECTORIES directory property. --- Meta/Lagom/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index cac45a33ab..b91396e474 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -538,7 +538,10 @@ if (BUILD_LAGOM) add_executable(gzip ../../Userland/Utilities/gzip.cpp) target_link_libraries(gzip LibCompress LibCore LibMain) - if (ENABLE_LAGOM_LADYBIRD) + # FIXME: Use PROJECT_IS_TOPLEVEL with cmake 3.21 + # Work around bug in JetBrains distributed CMake 3.27.2 where this causes infinite recursion in + # export_components() when called from CLion Nova by checking if we already have Ladybird included + if (ENABLE_LAGOM_LADYBIRD AND NOT ladybird_SOURCE_DIR) add_serenity_subdirectory(Ladybird) endif()