Open hz1624917200 opened 1 year ago
can you please share your fileApi file with us? the path to the file looks something like this:
"${workspaceFolder}\build\.cmake\api\v1\reply\target-envTest-Debug-62117f3e8a65ca9b8d89.json
", the file's name starts with "target
"
Oh, It seems that this problem is caused by an outdated cache. I can now completely reproduce this issue:
[cache] Reading CMake cache file e:/WorkSpace/C/cmake-3.25.1-tutorial-source/Step7/build/CMakeCache.txt
[cache] Parsing CMake cache string
cache update
in step1I suppose that we should update cache automatically after configure project(at least reconfigure with cache deleted).
(Please excuse me for my English, I'm not a native speaker : )
Sure, here it is.
{
"artifacts" :
[
{
"path" : "Tutorial.exe"
},
{
"path" : "Tutorial.pdb"
}
],
"backtrace" : 1,
"backtraceGraph" :
{
"commands" :
[
"add_executable",
"install",
"target_link_libraries",
"target_include_directories"
],
"files" :
[
"CMakeLists.txt"
],
"nodes" :
[
{
"file" : 0
},
{
"command" : 0,
"file" : 0,
"line" : 33,
"parent" : 0
},
{
"command" : 1,
"file" : 0,
"line" : 42,
"parent" : 0
},
{
"command" : 2,
"file" : 0,
"line" : 34,
"parent" : 0
},
{
"command" : 3,
"file" : 0,
"line" : 37,
"parent" : 0
}
]
},
"compileGroups" :
[
{
"compileCommandFragments" :
[
{
"fragment" : "-g -Xclang -gcodeview -O0 -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd"
},
{
"backtrace" : 3,
"fragment" : "-Wall"
},
{
"backtrace" : 3,
"fragment" : "-Wextra"
},
{
"backtrace" : 3,
"fragment" : "-Wshadow"
},
{
"backtrace" : 3,
"fragment" : "-Wformat=2"
},
{
"backtrace" : 3,
"fragment" : "-Wunused"
}
],
"includes" :
[
{
"backtrace" : 4,
"path" : "E:/WorkSpace/C/cmake-3.25.1-tutorial-source/Step7/build"
},
{
"backtrace" : 3,
"path" : "E:/WorkSpace/C/cmake-3.25.1-tutorial-source/Step7/MathFunctions"
}
],
"language" : "CXX",
"sourceIndexes" :
[
0
]
}
],
"dependencies" :
[
{
"backtrace" : 3,
"id" : "MathFunctions::@742f1924b0b2e2878db6"
}
],
"id" : "Tutorial::@6890427a1f51a3e7e1df",
"install" :
{
"destinations" :
[
{
"backtrace" : 2,
"path" : "bin"
}
],
"prefix" :
{
"path" : "C:/Program Files (x86)/Tutorial"
}
},
"link" :
{
"commandFragments" :
[
{
"fragment" : "-g -Xclang -gcodeview -O0 -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd",
"role" : "flags"
},
{
"fragment" : "-Xlinker /subsystem:console",
"role" : "flags"
},
{
"backtrace" : 3,
"fragment" : "MathFunctions\\MathFunctions.lib",
"role" : "libraries"
},
{
"fragment" : "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames",
"role" : "libraries"
}
],
"language" : "CXX"
},
"name" : "Tutorial",
"nameOnDisk" : "Tutorial.exe",
"paths" :
{
"build" : ".",
"source" : "."
},
"sourceGroups" :
[
{
"name" : "Source Files",
"sourceIndexes" :
[
0
]
}
],
"sources" :
[
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "tutorial.cxx",
"sourceGroupIndex" : 0
}
],
"type" : "EXECUTABLE"
}
@elahehrashedi Hello? Could you please update this issue's state?
This issue is now marked as 'stale' due to there being no activity on it for the past 30 days and being labelled 'more info needed'. Unless the 'stale' label is removed or the issue is commented on, this will be closed in 7 days. If you would like to make this issue exempt from getting stale, please remove the 'more info needed' and 'stale' labels or add the 'stale-exempt' label
@hz1624917200 Could you please provide a minimal repro for us to investigate this issue? Thanks!
Brief Issue Summary
Hello, on windows (MSVC or clang-cl (GNU CLI)), intellisense failed to recognize
target_compile_definitions
configured inCMakeLists.txt
. However, it passed the build stage with correct definitions. Those definitions are also set inCMakeCache
andcompile_commands.json
(with ninja generator).CMake Tools Diagnostics
Debug Log
Additional Information
After configuring as above, intellisense still can't recognize those definitions
and here is my CMakeCache content (part)
and in
compile_commands
, the flagHAVE_LOG
andHAVE_EXP
are also set.However, I didn't find any flags above in CMake Diagnostics, is there any exception occurred parsing files?