repository for a simple example project: https://bitbucket.org/ChristianW/cmake_driven_example_arm-none-eabi-gcc/src/master/
When using the arm-none-eabi-gcc compiler, the Eclipse C/C++ Editor does not recognize my symbols set in the CMakeLists.txt.
...
if(1)
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
else()
set(CMAKE_C_COMPILER gcc)
endif()
...
When using the gcc compiler, the Eclipse C/C++ Editor does recognize my symbols set in the CMakeLists.txt.
...
if(0)
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
else()
set(CMAKE_C_COMPILER gcc)
endif()
...
In both cases building the project is working. Any ideas what's the problem here?
Kind regards, Christian
Edit: content of CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
#set(CMAKE_MAKE_PROGRAM "C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/mingw32-make.exe")
set(CMAKE_MAKE_PROGRAM "C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/mingw32-make.exe")
#set(CMAKE_MAKE_PROGRAM "C:/Tools/ON Semiconductor/RSL10_IDE_3_3/IDE_V3.2.2.13/arm_tools/bin/make.exe")
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_CROSSCOMPILING 1)
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
set(CMAKE_C_OBJCOPY arm-none-eabi-objcopy)
if(1)
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
else()
set(CMAKE_C_COMPILER gcc)
endif()
project(cmake_driven_example_arm-none-eabi-gcc C)
set(SOURCES
main.c
modules/math/math.c
)
include_directories(
modules/math
)
set(CMAKE_C_FLAGS "-DINCLUDE_MATH")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMYVAR=5")
# Invoking: Cross ARM C Linker
set(CMAKE_EXE_LINKER_FLAGS "-Xlinker --gc-sections")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -T\"${CMAKE_SOURCE_DIR}/sdk_packages/rsl10_sdk/source/firmware/cmsis/source/GCC/sections_modified.ld\"")
# build elf file
add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries(${PROJECT_NAME}
${CMAKE_SOURCE_DIR}/sdk_packages/rsl10_sdk/lib/ble_core/Release/libblelib.a
${CMAKE_SOURCE_DIR}/sdk_packages/rsl10_sdk/lib/ble_core/Release/libkelib.a
)
The indexer was set to "Use a fixed build configuration". That's why I could build in different configurations, but the Editor always showed the flag values of my specified configuration (=Debug).
It should be possible to use project specific (PS) indexer settings, but...
There is a bug within Eclipse which leads to an unintuitive behaviour of the indexer (see bug205299):
WS: Window > Preferences > C/C++ > Indexer > Build configuration for the indexer: Use the build configuration specified in the projects's indexer settings
PS: Project Properties > C/C++ General > Indexer > User active build configuration
Solution: Use workspace specific (WS) indexer settings: Use active build configuration
Maybe there was also a problem caused by the path to the compiler: "...\IDE_V3.2.2.13\arm_tools\bin\arm-none-eabi-gcc.exe" -> dots in the folder name IDE_V3.2.2.13
It gave me these warnings: (fyi: in the sample project I have not defined the entry symbol Reset_Handler)
With moving arm_tools folder, the Eclipse Editor recognized the symbols.