From cef7489f72a0d58cea991bbe85155834cf9a4291 Mon Sep 17 00:00:00 2001 From: Chris Green Date: Wed, 1 Jul 2026 07:39:12 -0500 Subject: [PATCH] fix(cmake): move GNUInstallDirs include into cet_cmake_env macro The `include(GNUInstallDirs)` call performs work that must be executed when `cet_cmake_env()` is called, not merely when the `CetCMakeEnv.cmake` file is included. Fixes #38, #39 --- Modules/CetCMakeEnv.cmake | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Modules/CetCMakeEnv.cmake b/Modules/CetCMakeEnv.cmake index ed19b794..9b3a22e3 100644 --- a/Modules/CetCMakeEnv.cmake +++ b/Modules/CetCMakeEnv.cmake @@ -44,18 +44,6 @@ if(NOT CMAKE_INSTALL_LIBDIR) set(CMAKE_INSTALL_LIBDIR lib) # Don't use lib64 for installation dir. endif() -# See https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html. -# -# We suppress developer warnings for this `include()` to silence -# complaints from CMake >=4 when no `LANGUAGES` are enabled for this -# project. -set(_cce_suppress_dev_warnings "$CACHE{CMAKE_SUPPRESS_DEVELOP_WARNINGS}") -set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS ON CACHE INTERNAL "" FORCE) -include(GNUInstallDirs) -set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS "${_cce_suppress_dev_warnings}" CACHE INTERNAL "" FORCE) -unset(_cce_suppress_dev_warnings) -# ############################################################################## - define_property( TARGET PROPERTY CET_EXEC_LOCATION @@ -116,6 +104,19 @@ macro(cet_cmake_env) ) endif() + # ############################################################################## + # See https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html. + # + # We suppress developer warnings for this `include()` to silence + # complaints from CMake >=4 when no `LANGUAGES` are enabled for this + # project. + set(_cce_suppress_dev_warnings "$CACHE{CMAKE_SUPPRESS_DEVELOP_WARNINGS}") + set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS ON CACHE INTERNAL "" FORCE) + include(GNUInstallDirs) + set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS "${_cce_suppress_dev_warnings}" CACHE INTERNAL "" FORCE) + unset(_cce_suppress_dev_warnings) + # ############################################################################## + set(CETMODULES_CURRENT_PROJECT_NAME ${PROJECT_NAME}) # ############################################################################