Skip to content

Commit 65ebabb

Browse files
Deprioritize top level -O2 in CMAKE_CXX_FLAGS_RELEASE (#9394)
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.
1 parent 7fc176d commit 65ebabb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright (c) Meta Platforms, Inc. and affiliates.
2-
# Copyright 2024-2025 Arm Limited and/or its affiliates.
32
# All rights reserved.
3+
# Copyright 2024-2025 Arm Limited and/or its affiliates.
44
#
55
# This source code is licensed under the BSD-style license found in the
66
# LICENSE file in the root directory of this source tree.
@@ -161,7 +161,7 @@ if(OPTIMIZE_SIZE)
161161
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os")
162162
else()
163163
# -O2: Moderate opt.
164-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
164+
set(CMAKE_CXX_FLAGS_RELEASE "-O2 ${CMAKE_CXX_FLAGS_RELEASE}")
165165
endif()
166166

167167
option(EXECUTORCH_BUILD_ANDROID_JNI "Build Android JNI" OFF)

0 commit comments

Comments
 (0)