Skip to content

Commit 2e8a275

Browse files
Merge pull request #630 from bartlettroscoe/cmake-4.0.0-2
Set CMake policy CMP0144 to new to use <PACKAGENAME>_ROOT env vars
2 parents d27a47d + 6ad8cea commit 2e8a275

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

tribits/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
ChangeLog for TriBITS
33
----------------------------------------
44

5+
## 2025-03-22:
6+
7+
* **Changed:** Set CMake policy
8+
[CMP0144](https://cmake.org/cmake/help/latest/policy/CMP0144.html) to `NEW`
9+
(for versions of CMake 3.27+) so that `find_package(<PackageName> ...)` will
10+
use upper case env var `<PACKAGENAME>_ROOT`. Now, systems that are setting
11+
uppercase env var names for standard packages will get picked in CMake
12+
configures.
13+
514
## 2025-02-17:
615

716
* **Added:** Added support for header-only libraries with

tribits/core/common/TribitsCMakePolicies.cmake

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@
77
# *****************************************************************************
88
# @HEADER
99

10+
macro(tribits_set_cmake_policy_if_exists policyName oldOrNew)
11+
if (POLICY ${policyName})
12+
cmake_policy(SET ${policyName} ${oldOrNew})
13+
endif()
14+
endmacro()
15+
1016
# Define policies for CMake
11-
# It is assumed that the project has already called CMAKE_MINIMUM_REQUIRED.
12-
cmake_policy(SET CMP0003 NEW) # Don't split up full lib paths to linker args
13-
cmake_policy(SET CMP0007 NEW) # Don't ignore empty list items
14-
cmake_policy(SET CMP0053 NEW) # Make var references much faster
15-
cmake_policy(SET CMP0054 NEW) # Avoid quoted strings lookup variables
16-
cmake_policy(SET CMP0057 NEW) # Support if ( ... IN_LIST ... )
17-
cmake_policy(SET CMP0082 NEW) # Install rules follow order install() called in subdirs
17+
tribits_set_cmake_policy_if_exists(CMP0003 NEW) # Don't split up full lib paths to linker args
18+
tribits_set_cmake_policy_if_exists(CMP0007 NEW) # Don't ignore empty list items
19+
tribits_set_cmake_policy_if_exists(CMP0053 NEW) # Make var references much faster
20+
tribits_set_cmake_policy_if_exists(CMP0054 NEW) # Avoid quoted strings lookup variables
21+
tribits_set_cmake_policy_if_exists(CMP0057 NEW) # Support if ( ... IN_LIST ... )
22+
tribits_set_cmake_policy_if_exists(CMP0082 NEW) # Install rules follow order install() called in subdirs
23+
tribits_set_cmake_policy_if_exists(CMP0144 NEW) # find_package() use <PACKAGENAME>_ROOT env var

0 commit comments

Comments
 (0)