Skip to content

Commit

Permalink
cmake: fix check_set_linker_property() function
Browse files Browse the repository at this point in the history
Fix check_set_linker_property() to correctly handle multiple linker
flags passed on function call.

(cherry picked from commit 1728e04)

Original-Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
GitOrigin-RevId: 1728e04
Cr-Build-Id: 8737279667330072001
Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8737279667330072001
Copybot-Job-Name: zephyr-main-copybot-downstream
Change-Id: Iff34a2ceb62a4ffdb6c42e9c4d7898f6190ecd05
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5839788
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Reviewed-by: Yuval Peress <peress@google.com>
Tested-by: Keith Short <keithshort@chromium.org>
  • Loading branch information
tejlmand authored and Chromeos LUCI committed Sep 10, 2024
1 parent aaf9441 commit 6d3ff27
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions cmake/modules/extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2393,18 +2393,20 @@ function(check_set_linker_property)

list(GET LINKER_PROPERTY_PROPERTY 0 property)
list(REMOVE_AT LINKER_PROPERTY_PROPERTY 0)
set(option ${LINKER_PROPERTY_PROPERTY})

string(MAKE_C_IDENTIFIER check${option} check)
foreach(option ${LINKER_PROPERTY_PROPERTY})
string(MAKE_C_IDENTIFIER check${option} check)

set(SAVED_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${option}")
zephyr_check_compiler_flag(C "" ${check})
set(CMAKE_REQUIRED_FLAGS ${SAVED_CMAKE_REQUIRED_FLAGS})
set(SAVED_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${option}")
zephyr_check_compiler_flag(C "" ${check})
set(CMAKE_REQUIRED_FLAGS ${SAVED_CMAKE_REQUIRED_FLAGS})

if(${${check}})
set_property(TARGET ${LINKER_PROPERTY_TARGET} ${APPEND} PROPERTY ${property} ${option})
endif()
if(${${check}})
set_property(TARGET ${LINKER_PROPERTY_TARGET} ${APPEND} PROPERTY ${property} ${option})
set(APPEND "APPEND")
endif()
endforeach()
endfunction()

# 'set_compiler_property' is a function that sets the property for the C and
Expand Down

0 comments on commit 6d3ff27

Please sign in to comment.