From 1d82e533529211955916d86edc5954fa59b93659 Mon Sep 17 00:00:00 2001 From: Adrian Lundell Date: Tue, 18 Mar 2025 11:01:11 +0100 Subject: [PATCH] Deprioritize top level -O2 in CMAKE_CXX_FLAGS_RELEASE By prepending rather than appending to CMAKE_CXX_FLAGS_RELEASE, it allows to specify another optimization level earlier in the build process and still have that take precedence over the -O2. Change-Id: I98beba1fb84848fd6c83d55a8e5a9c1cf74e1943 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6509d4adeef..60e9c1158ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # Copyright (c) Meta Platforms, Inc. and affiliates. -# Copyright 2024-2025 Arm Limited and/or its affiliates. # All rights reserved. +# Copyright 2024-2025 Arm Limited and/or its affiliates. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. @@ -161,7 +161,7 @@ if(OPTIMIZE_SIZE) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os") else() # -O2: Moderate opt. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") + set(CMAKE_CXX_FLAGS_RELEASE "-O2 ${CMAKE_CXX_FLAGS_RELEASE}") endif() option(EXECUTORCH_BUILD_ANDROID_JNI "Build Android JNI" OFF)