From 2fc2ca765289d11dc2c482c04a364bc45feebd06 Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Wed, 1 Feb 2023 17:06:53 +0000 Subject: [PATCH] [BE]: Fix CMake LTO policy on pytorch (#93388) Not this is a non-functional change since non of our CIs actually build with LTO. Pull Request resolved: https://github.com/pytorch/pytorch/pull/93388 Approved by: https://github.com/albanD --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e2eb06bdcf..74031801fa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,12 @@ cmake_minimum_required(VERSION 3.18 FATAL_ERROR) cmake_policy(SET CMP0010 NEW) cmake_policy(SET CMP0025 NEW) +# Enables CMake to set LTO on compilers other than Intel. +cmake_policy(SET CMP0069 NEW) +# Enable the policy for CMake subprojects. +# protobuf currently causes issues +#set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) + # Suppress warning flags in default MSVC configuration. It's not # mandatory that we do this (and we don't if cmake is old), but it's # nice when it's possible, and it's possible on our Windows configs.