Enable CMP0074 to allow `${pkg}_ROOT`, especially for LLVM_ROOT (#3713)
authorFUJI Goro <goro@fastly.com>
Fri, 19 Nov 2021 04:40:01 +0000 (13:40 +0900)
committerGitHub <noreply@github.com>
Fri, 19 Nov 2021 04:40:01 +0000 (20:40 -0800)
set CMP0074 to allow the use of `LLVM_ROOT` env var

CMakeLists.txt

index e33856c2446d73a27b56edf42f640f27f88c8917..13abaec62a3014495e93276a752be065df69307f 100644 (file)
@@ -2,6 +2,10 @@
 # Licensed under the Apache License, Version 2.0 (the "License")
 cmake_minimum_required(VERSION 2.8.7)
 
+if (${CMAKE_VERSION} VERSION_EQUAL 3.12.0 OR ${CMAKE_VERSION} VERSION_GREATER 3.12.0)
+  cmake_policy(SET CMP0074 NEW)
+endif()
+
 project(bcc)
 if(NOT CMAKE_BUILD_TYPE)
   set(CMAKE_BUILD_TYPE Release)
@@ -73,7 +77,7 @@ endif()
 
 if(NOT PYTHON_ONLY)
 find_package(LLVM REQUIRED CONFIG)
-message(STATUS "Found LLVM: ${LLVM_INCLUDE_DIRS} ${LLVM_PACKAGE_VERSION}")
+message(STATUS "Found LLVM: ${LLVM_INCLUDE_DIRS} ${LLVM_PACKAGE_VERSION} (Use LLVM_ROOT envronment variable for another version of LLVM)")
 
 if(ENABLE_CLANG_JIT)
 find_package(BISON)