Include_directories() add a path that include "-", compile_commands.json don't include this path, why?

as title says, when I add a absolute path in my CmakeLists.txt, generated compile_commands.json don’t include the path.

set(INCLUDE_PATH "D:/gnuarmemb/arm-none-eabi/include")
include_directories(${INCLUDE_PATH})

This path is not appeared in compile_commands.json

set(INCLUDE_PATH "D:/gnuarmemb/armnoneeabi/include")
include_directories(${INCLUDE_PATH})

This path is appeared in compile_commands.json

  • which generator are you using on windows?
  • and which cmake version?
  • why do you not use a toolchain for your cross compiler?

Sorry for I’m not showing all information.
1.I use “MinGW Makefiles” generator
2.CMAKE version I used is 3.26.4
3.Do you mean specify “CMAKE_TOOLCHAIN_FILE”? I had specify a toolchain for my project.
thank you a lot.

I’m already known why. When I use cross compiler, and I specify toolchain(arm-none-eabi-gcc is in path “D:/gnuarmemb/arm-none-eabi/bin”) , CMAKE thinks the “D:/gnuarmemb/arm-none-eabi/include” is default search path, so the path not appear in compile_commands.json file. When I change folder name, cmake thinks the path is what I want to search . That’s all.