From 32e4f236b7635fe5008966065ec4099ba23ecf58 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 23 May 2019 09:19:59 -0400 Subject: ARMClang: fix policy manipulation in the compiler module Policies have their own scoping and cannot be set within a function without affecting callers. --- Modules/Compiler/ARMClang.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Modules/Compiler/ARMClang.cmake b/Modules/Compiler/ARMClang.cmake index 5ca49df..2518ac7 100644 --- a/Modules/Compiler/ARMClang.cmake +++ b/Modules/Compiler/ARMClang.cmake @@ -3,6 +3,9 @@ if(_ARMClang_CMAKE_LOADED) endif() set(_ARMClang_CMAKE_LOADED TRUE) +cmake_policy(PUSH) +cmake_policy(SET CMP0057 NEW) # if IN_LIST + get_filename_component(_CMAKE_C_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH) get_filename_component(_CMAKE_CXX_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH) @@ -29,9 +32,6 @@ endfunction() # check processor is in list function(__armclang_check_processor processor list out_var) string(TOLOWER "${processor}" processor) - if(POLICY CMP0057) - cmake_policy(SET CMP0057 NEW) - endif() if(processor IN_LIST list) set(${out_var} TRUE PARENT_SCOPE) else() @@ -67,3 +67,5 @@ macro(__compiler_armclang lang) set(CMAKE_${lang}_OUTPUT_EXTENSION ".o") set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1) endmacro() + +cmake_policy(POP) -- cgit v0.12