mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
18 lines
714 B
CMake
18 lines
714 B
CMake
# SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
# Remove duplicates from a string containing compilation flags
|
|
function(remove_duplicated_flags FLAGS UNIQFLAGS)
|
|
set(FLAGS_LIST "${FLAGS}")
|
|
# Remove leading and trailing spaces
|
|
string(STRIP "${FLAGS_LIST}" FLAGS_LIST)
|
|
# Convert the given flags, as a string, into a CMake list type
|
|
separate_arguments(FLAGS_LIST)
|
|
# Remove all the duplicated flags
|
|
list(REMOVE_DUPLICATES FLAGS_LIST)
|
|
# Convert the list back to a string
|
|
string(REPLACE ";" " " FLAGS_LIST "${FLAGS_LIST}")
|
|
# Return that string to the caller
|
|
set(${UNIQFLAGS} "${FLAGS_LIST}" PARENT_SCOPE)
|
|
endfunction()
|