Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom browse configuration should not include (redundant) per-file arguments #2645

Closed
Colengms opened this issue Jul 14, 2022 · 0 comments · Fixed by #2754
Closed

Custom browse configuration should not include (redundant) per-file arguments #2645

Colengms opened this issue Jul 14, 2022 · 0 comments · Fixed by #2754

Comments

@Colengms
Copy link
Contributor

Brief Issue Summary

When using a CMakeLists.txt file such as:

cmake_minimum_required(VERSION 3.23)

project (test)

add_executable (test test.cpp test2.cpp test3.cpp)

set_source_files_properties(test.cpp PROPERTIES COMPILE_FLAGS -someflag1)
set_source_files_properties(test2.cpp PROPERTIES COMPILE_FLAGS -someflag2)

I'm seeing that the following custom browse configuration is being generated:

Custom browse configuration received: {
  "browsePath": [
    "z:/repos/test"
  ],
  "compilerPath": "c:/program files/llvm/bin/clang++.exe",
  "compilerArgs": [],
  "compilerFragments": [
    "-g -Xclang -gcodeview -O0 -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd",
    "-someflag1",
    "-g -Xclang -gcodeview -O0 -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd",
    "-someflag2",
    "-g -Xclang -gcodeview -O0 -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd"
  ]
}

It looks like all possible sets of arguments are being combined into a single set. This will not always produce a valid set of arguments to pass on a single command line (even if duplicates are ignored).

I had actually discussed with Bob changing this structure in the cpptools-api to use an array of command lines, which would address this. Multiple compiler probes could occur, pulling system includes into the browse path from multiple command lines used in the build, instead of just one.

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

@elahehrashedi elahehrashedi added Feature: configure bug a bug in the product labels Jul 18, 2022
@elahehrashedi elahehrashedi added this to the 1.12 milestone Jul 18, 2022
@bobbrow bobbrow modified the milestones: 1.12, On Deck Aug 26, 2022
@bobbrow bobbrow modified the milestones: On Deck, 1.13 Sep 26, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants