I’m using CMake with VS Code in Windows with gcc on ARM. I’ve tried fixing this a couple times, but never been successful. Whenever I run CMake configure, it always runs twice. This is annoying becuase the second time it looks like the command line options are not running. Any help is appreciated. This seems like it is the sticking spot:
[cmake] You have changed variables that require your cache to be deleted.
[cmake] Configure will be re-run and you may have to reset some variables.
[cmake] The following variables have changed:
[cmake] CMAKE_C_COMPILER= C:/arm/bin/arm-none-eabi-gcc.exe
I am setting the location of my compiler tools in my CMake file. Is there a better way to do this? Here’s the section from CMakeLists.txt:
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(CMAKE_C_COMPILER $ENV{GCC_ARM_COMPILER_PATH}/bin/arm-none-eabi-gcc.exe)
set(CMAKE_CXX_COMPILER $ENV{GCC_ARM_COMPILER_PATH}/bin/arm-none-eabi-g++.exe)
set(AS $ENV{GCC_ARM_COMPILER_PATH}/bin/arm-none-eabi-as.exe)
set(AR $ENV{GCC_ARM_COMPILER_PATH}/bin/arm-none-eabi1.exe)
set(OBJCOPY $ENV{GCC_ARM_COMPILER_PATH}/bin/arm-none-eabi-objcopy.exe)
set(OBJDUMP $ENV{GCC_ARM_COMPILER_PATH}/bin/arm-none-eabi-objdump.exe)
set(SIZE $ENV{GCC_ARM_COMPILER_PATH}/bin/arm-none-eabi-size.exe)
if (${CMAKE_VERBOSE_INFO_LEVEL} LESS_EQUAL ${CMAKE_VERBOSE_LEVEL})
message(STATUS "Windows GCC Path is: " ${CMAKE_C_COMPILER})
endif()
else ()
set(CMAKE_C_COMPILER $ENV{GCC_ARM_COMPILER_PATH}/bin/arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER $ENV{GCC_ARM_COMPILER_PATH}/bin/arm-none-eabi-g++)
set(AS $ENV{GCC_ARM_COMPILER_PATH}/bin/arm-none-eabi-as)
set(AR $ENV{GCC_ARM_COMPILER_PATH}/bin/arm-none-eabi-ar)
set(OBJCOPY $ENV{GCC_ARM_COMPILER_PATH}/bin/arm-none-eabi-objcopy)
set(OBJDUMP $ENV{GCC_ARM_COMPILER_PATH}/bin/arm-none-eabi-objdump)
set(SIZE $ENV{GCC_ARM_COMPILER_PATH}/bin/arm-none-eabi-size)
if (${CMAKE_VERBOSE_INFO_LEVEL} LESS_EQUAL ${CMAKE_VERBOSE_LEVEL})
message(STATUS "Unix GCC Path is: " ${CMAKE_C_COMPILER})
endif()
endif ()
Here’s the whole output:
[main] Configuring project: marshall_gps2_firmware
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:\arm\bin\arm-none-eabi-gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\arm\bin\arm-none-eabi-g++.exe -SC:/mrt/products/G2/marshall_gps2_firmware -BC:/mrt/products/G2/marshall_gps2_firmware/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- CMake verbose level: info - 2
[cmake] -- Setting target information.
[cmake] -- Build Type Debug is being used
[cmake] -- current directory is : C:/mrt/products/G2/marshall_gps2_firmware
[cmake] -- path above is : C:/mrt/products/G2
[cmake] -- Project path is: C:/mrt/products/G2/marshall_gps2_firmware
[cmake] -- Project path is: C:/mrt/products/G2/marshall_gps2_firmware
[cmake] -- Host System is: Windows
[cmake] -- $GCC_ARM_COMPILER_PATH is: c:/arm
[cmake] -- MY_BOARD is: G2_V2_HW
[cmake] -- Setting compiler path for Windows
[cmake] -- Windows GCC Path is: c:/arm/bin/arm-none-eabi-gcc.exe
[cmake] -- Setting project details
[cmake] -- 7499a125077139e18c375ede30208b8f1188124a
[cmake] -- GitDiff:
[cmake] -- GitTag:
[cmake] -- GitBranch:roaming
[cmake]
[cmake] -- Setting Compiler Variables...
[cmake] -- Build info:
[cmake] -- Current directory is: C:/mrt/products/G2/marshall_gps2_firmware
[cmake] -- Building Project: G2_APP_G2_V2_HW
[cmake] -- Board Target: G2_V2_HW
[cmake] -- Building Version: 0.3.00.7499a125
[cmake] -- Adding include directories...
[cmake] -- Including Directories for LPC5528 MCU
[cmake] -- Setting ASM compiler flags...
[cmake] -- Setting C compiler flags...
[cmake] -- Setting C++ compiler flags...
[cmake] -- Setting linker flags...
[cmake] -- Setting conditional compiler flags...
[cmake] -- Adding regex filter.
[cmake] -- Adding adding sources...
[cmake] -- Filtering out undesired sources...
[cmake] -- Creating executable...
[cmake] -- Adding linker libraries...
[cmake] -- Creating outputs files...
[cmake] -- elf file: C:/mrt/products/G2/marshall_gps2_firmware/outputs/G2_APP_G2_V2_HW_0_3_00_7499a125_BL/G2_APP_G2_V2_HW_0_3_00_7499a125_BL.elf
[cmake] -- Hex file: C:/mrt/products/G2/marshall_gps2_firmware/outputs/G2_APP_G2_V2_HW_0_3_00_7499a125_BL/G2_APP_G2_V2_HW_0_3_00_7499a125_BL.hex
[cmake] -- Bin file: C:/mrt/products/G2/marshall_gps2_firmware/outputs/G2_APP_G2_V2_HW_0_3_00_7499a125_BL/G2_APP_G2_V2_HW_0_3_00_7499a125_BL.bin
[cmake] -- Setting custom command...
[cmake] -- Configuring done (0.4s)
[cmake] You have changed variables that require your cache to be deleted.
[cmake] Configure will be re-run and you may have to reset some variables.
[cmake] The following variables have changed:
[cmake] CMAKE_C_COMPILER= C:/arm/bin/arm-none-eabi-gcc.exe
[cmake]
[cmake] -- CMake verbose level: info - 2
[cmake] -- Setting target information.
[cmake] -- Build Type Not Defined By IDE
[cmake] -- Build Type Debug is being used
[cmake] -- current directory is : C:/mrt/products/G2/marshall_gps2_firmware
[cmake] -- path above is : C:/mrt/products/G2
[cmake] -- Project path is: C:/mrt/products/G2/marshall_gps2_firmware
[cmake] -- Project path is: C:/mrt/products/G2/marshall_gps2_firmware
[cmake] -- Host System is: Windows
[cmake] -- $GCC_ARM_COMPILER_PATH is: c:/arm
[cmake] -- MY_BOARD is: G2_V2_HW
[cmake] -- Setting compiler path for Windows
[cmake] -- Windows GCC Path is: c:/arm/bin/arm-none-eabi-gcc.exe
[cmake] -- The C compiler identification is GNU 10.3.1
[cmake] -- The ASM compiler identification is GNU
[cmake] -- Found assembler: C:/arm/bin/arm-none-eabi-gcc.exe
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - failed
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Setting project details
[cmake] -- 7499a125077139e18c375ede30208b8f1188124a
[cmake] -- GitDiff:
[cmake] -- GitTag:
[cmake] -- GitBranch:roaming
[cmake]
[cmake] -- Setting Compiler Variables...
[cmake] -- Build info:
[cmake] -- Current directory is: C:/mrt/products/G2/marshall_gps2_firmware
[cmake] -- Building Project: G2_APP_G2_V2_HW
[cmake] -- Board Target: G2_V2_HW
[cmake] -- Building Version: 0.3.00.7499a125
[cmake] -- Adding include directories...
[cmake] -- Including Directories for LPC5528 MCU
[cmake] -- Setting ASM compiler flags...
[cmake] -- Setting C compiler flags...
[cmake] -- Setting C++ compiler flags...
[cmake] -- Setting linker flags...
[cmake] -- Setting conditional compiler flags...
[cmake] -- Adding regex filter.
[cmake] -- Adding adding sources...
[cmake] -- Filtering out undesired sources...
[cmake] -- Creating executable...
[cmake] -- Adding linker libraries...
[cmake] -- Creating outputs files...
[cmake] -- elf file: C:/mrt/products/G2/marshall_gps2_firmware/outputs/G2_APP_G2_V2_HW_0_3_00_7499a125_BL/G2_APP_G2_V2_HW_0_3_00_7499a125_BL.elf
[cmake] -- Hex file: C:/mrt/products/G2/marshall_gps2_firmware/outputs/G2_APP_G2_V2_HW_0_3_00_7499a125_BL/G2_APP_G2_V2_HW_0_3_00_7499a125_BL.hex
[cmake] -- Bin file: C:/mrt/products/G2/marshall_gps2_firmware/outputs/G2_APP_G2_V2_HW_0_3_00_7499a125_BL/G2_APP_G2_V2_HW_0_3_00_7499a125_BL.bin
[cmake] -- Setting custom command...
[cmake] -- Configuring done (0.9s)
[cmake] -- Generating done (0.1s)
[cmake] -- Build files have been written to: C:/mrt/products/G2/marshall_gps2_firmware/build