mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
Build: CMake compiler flags will be set, regardless of the cache status
Defining CMake variables from the command-line or from another CMake project, such as `-DCMAKE_C_FLAGS= -DCMAKE_CXX_FLAGS=`, caused a link failure as ESP CMake was unable to set its proper compilation flags. Additional CMake compiler flags can now be provided by another project. * Closes https://github.com/espressif/esp-idf/issues/7507
This commit is contained in:
@@ -4,6 +4,10 @@ set(CMAKE_C_COMPILER riscv32-esp-elf-gcc)
|
||||
set(CMAKE_CXX_COMPILER riscv32-esp-elf-g++)
|
||||
set(CMAKE_ASM_COMPILER riscv32-esp-elf-gcc)
|
||||
|
||||
set(CMAKE_C_FLAGS "-march=rv32imc" CACHE STRING "C Compiler Base Flags")
|
||||
set(CMAKE_CXX_FLAGS "-march=rv32imc" CACHE STRING "C++ Compiler Base Flags")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-nostartfiles -march=rv32imc --specs=nosys.specs" CACHE STRING "Linker Base Flags")
|
||||
list(APPEND compile_options "-march=rv32imc")
|
||||
|
||||
# Option `--specs` must only be defined ONCE in the final linker command, else GCC will complain:
|
||||
# "attempt to rename spec 'link_gcc_c_sequence' to already defined spec 'nosys_link_gcc_c_sequence'"
|
||||
# so unset `link_options` first.
|
||||
unset(link_options)
|
||||
list(APPEND link_options "-nostartfiles" "-march=rv32imc" "--specs=nosys.specs")
|
||||
|
Reference in New Issue
Block a user