Reputation: 585
I'm running VS 2010 SP1 and I have a special analysis configuration that runs once a week (because it takes a long time for the build server to analyze everything).
I'd like this configuration to run without bothering to link. If the analysis passes for all the code in a project, then I'd like the build to just continue on to the next project without linking.
I can't see a way to tell VS to just run the C++ compiler without linking. Does anyone know of a way to do this within an existing vcxproj?
[Edit] Clarification: I'd like this to work from within the IDE.
My next course of action is hand editing the vcxproj to see if I can't get rid of the link phase of building.
Upvotes: 9
Views: 5960
Reputation: 324
Microsoft docs claim that this option is not available from within the development environment.
Upvotes: 0
Reputation: 585
OK, I wasn't completely specific in my question, what I should have asked is: "Can I run static code analysis on C++ projects without linking?".
The recent answer is "Yes, with VS 2017 use the msbuild property RunCodeAnalysisOnce=true".
Upvotes: 2
Reputation: 1839
Just in this situation; trying to build without linking when using the IDE.
To achieve this for my configuration, I've altered the configuration type of my application:
General -> Project Defaults -> Configuration Type
Specifically, changing from Application (.exe)
to Static library (.lib)
. This will allow all your project(s) to build, but not require any linking to occur.
Upvotes: 3
Reputation: 283634
The C++ compiler cl.exe
certainly can, that's the /c
switch (compile only, don't link). Not sure about the msbuild
system that the IDE uses and that works with .vcxproj
files, though.
According to the documentation, this should work:
msbuild /target:Compile projectfile
or
msbuild /target:projectname:Compile solutionfile
You might also be interested in the /filelogger
and /fileloggerparameters
options, which let you capture build messages.
Upvotes: 4