mirror of
https://github.com/espressif/esp-idf.git
synced 2026-01-08 02:30:03 +00:00
Currently, the toolchain CMake files use the remove_duplicated_flags function from utilities.cmake. The cmakev2 implementation also includes this function for backward compatibility. Move the remove_duplicated_flags function to a separate file, deduplicate_flags.cmake, so it can be shared between cmakev1 and cmakev2. Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
16 lines
628 B
CMake
16 lines
628 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}")
|
|
# 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()
|