Skip to content

Commit

Permalink
no strict aliasing optional
Browse files Browse the repository at this point in the history
Furthermore, not enforcing compiler flags anymore
  • Loading branch information
robamu committed Jul 13, 2021
1 parent ae93e9f commit ac4ddbc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmake/stm32/utilities.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@ function(stm32_util_create_family_targets FAMILY)

option(STM32_ENABLE_FAST_MATH "Add -ffast-math compiler flag" OFF)
option(STM32_NO_BUILTIN "Add -fno-builtin compiler flag" OFF)
option(STM32_NO_STRICT_ALIASING "Add -fno-strict-aliasing compiler flag" OFF)

if(NOT (TARGET STM32::${FAMILY}${CORE_C}))
set(STM32_COMPILE_OPTIONS
-mthumb -mabi=aapcs -Wall -ffunction-sections -fdata-sections -fno-strict-aliasing
-mthumb -mabi=aapcs -Wall -ffunction-sections -fdata-sections
)
if(STM32_ENABLE_FAST_MATH)
list(APPEND STM32_COMPILE_OPTIONS -ffast-math)
endif()
if(STM32_NO_BUILTIN)
list(APPEND STM32_COMPILE_OPTIONS -fno-builtin)
endif()
if(STM32_NO_STRICT_ALIASING)
list(APPEND STM32_COMPILE_OPTIONS -fno-strict-aliasing)
endif()

add_library(STM32::${FAMILY}${CORE_C} INTERFACE IMPORTED)
target_compile_options(STM32::${FAMILY}${CORE_C} INTERFACE
--sysroot="${TOOLCHAIN_SYSROOT}"
${STM32_COMPILE_OPTIONS}
$<$<CONFIG:Debug>:-Og>
$<$<CONFIG:Release>:-Os>
)
target_link_options(STM32::${FAMILY}${CORE_C} INTERFACE
--sysroot="${TOOLCHAIN_SYSROOT}"
-mthumb -mabi=aapcs -Wl,--gc-sections
$<$<CONFIG:Debug>:-Og>
$<$<CONFIG:Release>:-Os -s>
)
target_compile_definitions(STM32::${FAMILY}${CORE_C} INTERFACE
STM32${FAMILY}
Expand Down

0 comments on commit ac4ddbc

Please sign in to comment.