MantisBT - CMake |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0014858 | CMake | CMake | public | 2014-04-01 11:51 | 2014-10-06 10:33 |
|
Reporter | Michael Priestman | |
Assigned To | Brad King | |
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | |
Platform | x64 | OS | Windows | OS Version | 7 |
Product Version | CMake 2.8.12.2 | |
Target Version | CMake 3.1 | Fixed in Version | CMake 3.1 | |
|
Summary | 0014858: Flags specified for the compiler do not stay together during processing. |
Description | I want to enable code analysis in Visual Studio. To do this, you add the following flags to the compiler:
/analyze /analyze:log output.xml
When I try to do this with the following snippet of CMake:
set(CMAKE_C_FLAGS "/analyze /analyze:log output.xml")
It mangles the arguments. Firstly, it puts quotes around the "log" part, and secondly, the "output.xml" does not follow immediately after the "/analyze:log" argument, which is a compile error.
I have had this working in a previous version of CMake; I think it worked in version 2.8.9, but stopped working in (I think) 2.8.12. |
Steps To Reproduce | Attached files reproduce the problem with Visual Studio 11 generator.
Generate Visual Studio 11 solution and try to build. You'll get a compile error saying /analyze:log requires an argument. |
Additional Information | |
Tags | No tags attached. |
Relationships | |
Attached Files | CMakeAnalyzeError.zip (483) 2014-04-01 11:51 https://public.kitware.com/Bug/file/5118/CMakeAnalyzeError.zip |
|
Issue History |
Date Modified | Username | Field | Change |
2014-04-01 11:51 | Michael Priestman | New Issue | |
2014-04-01 11:51 | Michael Priestman | File Added: CMakeAnalyzeError.zip | |
2014-04-01 13:07 | Brad King | Note Added: 0035608 | |
2014-04-01 13:17 | Brad King | Note Added: 0035609 | |
2014-04-01 13:21 | Michael Priestman | Note Added: 0035610 | |
2014-04-01 14:25 | Brad King | Note Added: 0035611 | |
2014-04-01 14:37 | Michael Priestman | Note Added: 0035612 | |
2014-04-01 14:37 | Michael Priestman | Note Edited: 0035612 | bug_revision_view_page.php?bugnote_id=35612#r1430 |
2014-04-02 09:24 | Brad King | Note Added: 0035621 | |
2014-04-03 13:26 | Brad King | Assigned To | => Brad King |
2014-04-03 13:26 | Brad King | Status | new => resolved |
2014-04-03 13:26 | Brad King | Resolution | open => fixed |
2014-04-03 13:26 | Brad King | Fixed in Version | => CMake 3.1 |
2014-04-03 13:26 | Brad King | Target Version | => CMake 3.1 |
2014-10-06 10:33 | Robert Maynard | Note Added: 0036963 | |
2014-10-06 10:33 | Robert Maynard | Status | resolved => closed |
Notes |
|
(0035608)
|
Brad King
|
2014-04-01 13:07
|
|
In CMake 2.8.9 these flags would have been passed through raw to the project file AdditionalOptions setting. Since then this post-2.8.9 commit:
VS11: Generate flag tables from MSBuild V110 tool files
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9b2dda5d [^]
introduced the proper mapping from flags to project file settings. Clearly something goes wrong with the mapping for this flag. |
|
|
(0035609)
|
Brad King
|
2014-04-01 13:17
|
|
|
|
(0035610)
|
Michael Priestman
|
2014-04-01 13:21
|
|
|
|
(0035611)
|
Brad King
|
2014-04-01 14:25
|
|
AFAICT the /analyze options are only available through the IDE with VS Enterprise Team Developer to which I do not have access. How are
/analyze:WX-
/analyze:quiet
/analyze:stacksize number
/analyze:max_paths number
/analyze:only
each represented in .vcxproj files? I especially need help with the stacksize and max_paths cases because they also require a separate argument like "log". |
|
|
(0035612)
|
Michael Priestman
|
2014-04-01 14:37
|
|
In the UI, you can only enable or disable code analysis. You don't have access to the extended options. Enabling Code Analysis adds the indicated lines to the vcxproj file:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
--> <RunCodeAnalysis>true</RunCodeAnalysis> <--
</PropertyGroup>
and
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
--> <EnablePREfast>true</EnablePREfast> <--
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
I think all the other options, such as the log and stacksize need to be passed in to the compiler on the command line. When I added the "/analyze:log" option to the project, I got the following in the project file under the ClCompile section shown above:
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<EnablePREfast>true</EnablePREfast>
--> <AdditionalOptions>/analyze:log output.xml %(AdditionalOptions)</AdditionalOptions> <--
</ClCompile>
I hope this helps...
|
|
|
(0035621)
|
Brad King
|
2014-04-02 09:24
|
|
|
|
(0036963)
|
Robert Maynard
|
2014-10-06 10:33
|
|
Closing resolved issues that have not been updated in more than 4 months. |
|