From a2a8dad980b0fa1a6086e0c0f95847ae80f5a2c6 Mon Sep 17 00:00:00 2001 From: Shilei Tian Date: Tue, 23 Jan 2024 14:06:20 -0500 Subject: [PATCH] SWDEV-442719 - Set CMP0074 to NEW to make sure `find_package` works correctly If a system has LLVM installed, `find_package` could choose that one even if we set `HIP_LLVM_ROOT`. `LLVM_ROOT` is ignored because of this CMake policy is set to `OLD` by default. Change-Id: I18fa0453afe170c229e92d6ddc386b43eb0c44f6 --- hipamd/src/CMakeLists.txt | 4 ++++ hipamd/src/hiprtc/CMakeLists.txt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/hipamd/src/CMakeLists.txt b/hipamd/src/CMakeLists.txt index b2bf28bbaa..814bf33d0f 100644 --- a/hipamd/src/CMakeLists.txt +++ b/hipamd/src/CMakeLists.txt @@ -20,6 +20,10 @@ cmake_minimum_required(VERSION 3.5.1) +if (POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() + include(GNUInstallDirs) set(VERSION_MAJOR_AMDHIP ${HIP_VERSION_MAJOR}) diff --git a/hipamd/src/hiprtc/CMakeLists.txt b/hipamd/src/hiprtc/CMakeLists.txt index 6565e25ecd..3c81a918ff 100644 --- a/hipamd/src/hiprtc/CMakeLists.txt +++ b/hipamd/src/hiprtc/CMakeLists.txt @@ -27,6 +27,10 @@ cmake_minimum_required(VERSION 3.16.1) option(BUILD_SHARED_LIBS "Build the shared library" ON) +if (POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") if(BUILD_SHARED_LIBS)