|
|
@@ -51,18 +51,22 @@ FetchContent_Declare(
|
|
|
)
|
|
|
FetchContent_MakeAvailable(spdlog)
|
|
|
|
|
|
-# Google Test
|
|
|
-FetchContent_Declare(
|
|
|
- googletest
|
|
|
- GIT_REPOSITORY https://github.com/google/googletest.git
|
|
|
- GIT_TAG release-1.11.0 # Or a more recent stable release
|
|
|
-)
|
|
|
-# FetchContent_MakeAvailable(googletest) # This is not enough for subdirectories
|
|
|
-FetchContent_GetProperties(googletest) # Get properties to use SOURCE_DIR and BINARY_DIR
|
|
|
-if(NOT googletest_POPULATED)
|
|
|
- FetchContent_Populate(googletest)
|
|
|
+# Try to find system GoogleTest first (Nix-shell provided)
|
|
|
+find_package(GTest)
|
|
|
+
|
|
|
+if(GTest_FOUND)
|
|
|
+ message(STATUS "Found system GoogleTest: ${GTest_VERSION}")
|
|
|
+ # Note: System GTest exports targets as GTest::gtest and GTest::gtest_main
|
|
|
+else()
|
|
|
+ message(STATUS "System GoogleTest not found. Fetching via Git...")
|
|
|
+
|
|
|
+ FetchContent_Declare(
|
|
|
+ googletest
|
|
|
+ GIT_REPOSITORY https://github.com/google/googletest.git
|
|
|
+ GIT_TAG v1.15.2 # Keep this updated to prevent the MacOS CMake 4.1 error!
|
|
|
+ )
|
|
|
+ FetchContent_MakeAvailable(googletest)
|
|
|
endif()
|
|
|
-add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) # Expose targets to subdirectories
|
|
|
|
|
|
# Core library (UI-independent)
|
|
|
add_library(lumacs_core STATIC
|
|
|
@@ -132,4 +136,4 @@ endif()
|
|
|
|
|
|
# Enable testing
|
|
|
enable_testing()
|
|
|
-add_subdirectory(tests)
|
|
|
+add_subdirectory(tests)
|