From 92dcf8417459df3776367e8dcb9e9e495d483c2c Mon Sep 17 00:00:00 2001 From: Oliver Lantwin Date: Fri, 5 Jun 2026 09:35:34 +0200 Subject: [PATCH] chore(build): drop pre-project GNUInstallDirs include and add SQLite3::SQLite3 shim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two unrelated but trivial CMake dev warnings surfaced on every CI configure step: - The top-level CMakeLists.txt included GNUInstallDirs before project(), which trips a 'no target architecture is known' warning because GNUInstallDirs cannot pick a libdir until a language is enabled. The second include later in the file (after project(... LANGUAGES CXX)) is correctly placed and already provides the install-dir variables used downstream — the pre-project include was redundant. - apps/CMakeLists.txt linked against SQLite::SQLite3. CMake 4.3 renamed the FindSQLite3 target to SQLite3::SQLite3 and marked the old name deprecated, so every target_link_libraries call against it fired a dev warning. Switch the linkage to SQLite3::SQLite3 and add the alias-shim recommended by the FindSQLite3 docs so the build still works on older CMake (< 4.3) that only ships SQLite::SQLite3. No behaviour change. --- CMakeLists.txt | 8 +++++++- apps/CMakeLists.txt | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 826fb25..c50ea44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,6 @@ # Copyright (C) CERN for the benefit of the SHiP Collaboration cmake_minimum_required(VERSION 3.16) -include(GNUInstallDirs) project( SHiPGeometry @@ -23,6 +22,13 @@ find_package(GeoModelCore REQUIRED) find_package(GeoModelIO REQUIRED) find_package(GeoModelTools REQUIRED) find_package(SQLite3 REQUIRED) +# Compatibility shim recommended by CMake's FindSQLite3 docs: older CMake +# (< 4.3) only defines SQLite::SQLite3; newer CMake defines SQLite3::SQLite3 +# and marks the old name deprecated. Adding the alias lets us use the new +# canonical name unconditionally. +if(NOT TARGET SQLite3::SQLite3) + add_library(SQLite3::SQLite3 ALIAS SQLite::SQLite3) +endif() # Testing include(CTest) diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index f1a550f..9b5ae3c 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -12,7 +12,7 @@ target_link_libraries( ) add_executable(validate_geometry validate_geometry.cpp) -target_link_libraries(validate_geometry PRIVATE SQLite::SQLite3) +target_link_libraries(validate_geometry PRIVATE SQLite3::SQLite3) include(GNUInstallDirs) install(