cmake: only optimize for size on NuttX

With this change only builds for NuttX which are very much flash size
constraint are optimized for size. All other builds (e.g. SITL,
Snapdragon, etc.) are left at the default for debugging or -O2 for the
usual use.
This commit is contained in:
Julian Oes
2016-09-30 08:11:51 +02:00
committed by Beat Küng
parent 8ff237c69f
commit b1708f3871
+8 -2
View File
@@ -675,7 +675,9 @@ function(px4_add_common_flags)
if ($ENV{MEMORY_DEBUG} MATCHES "1")
message(STATUS "address sanitizer enabled")
set(max_optimization -Os)
if ("${OS}" STREQUAL "nuttx")
set(max_optimization -Os)
endif()
# Do not use optimization_flags (without _) as that is already used.
set(_optimization_flags
@@ -687,7 +689,11 @@ function(px4_add_common_flags)
-g3 -fsanitize=address
)
else()
set(max_optimization -Os)
if ("${OS}" STREQUAL "nuttx")
set(max_optimization -Os)
else()
set(max_optimization -O2)
endif()
if ("${OS}" STREQUAL "qurt")
set(PIC_FLAG -fPIC)