[cmake-developers] [CMake 0011925]: Visual Studio 2010 Generator mixing ClInclude and ClCompile tags for the same file
Mantis Bug Tracker
mantis at public.kitware.com
Thu Mar 3 18:23:45 EST 2011
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=11925
======================================================================
Reported By: Farid Zaripov
Assigned To:
======================================================================
Project: CMake
Issue ID: 11925
Category: CMake
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2011-03-03 18:23 EST
Last Modified: 2011-03-03 18:23 EST
======================================================================
Summary: Visual Studio 2010 Generator mixing ClInclude and
ClCompile tags for the same file
Description:
If you add the .cpp file to the exe or library target and set HEADER_FILE_ONLY
property to TRUE, then this file appears in .vcxproj file within <ClInclude> tag
and in .vcxproj.filters file within <ClCompile> tag. Because of this the VS IDE
places this file at the project root instead of specified source group.
Steps to Reproduce:
1. Use the following CMakeLists.txt:
------------
project(bug)
set_source_files_properties(bug.cpp PROPERTIES HEADER_FILE_ONLY TRUE)
source_group("Header Files\\subfolder1" FILES bug.cpp)
add_library(buglib STATIC bug.cpp)
------------
and with simple bug.cpp
2) Run cmake with Visual Studio 2010 Generator
Generated buglib.vcxproj contains:
------------
...
<ItemGroup>
<ClInclude Include="..\bug.cpp" />
</ItemGroup>
...
------------
Generated buglib.vcxproj.filters contains:
------------
...
<ItemGroup>
<ClCompile Include="..\bug.cpp">
<Filter>Header Files\subfolder1</Filter>
</ClCompile>
</ItemGroup>
...
------------
Additional Information:
The proposed patch:
-----------------------------------
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx
b/Source/cmVisualStudio10TargetGenerator.cxx
index 8a27ffd..d76b6a0 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -456,7 +456,11 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
{
lang = "None";
}
- if(lang[0] == 'C')
+ if(header)
+ {
+ headers.push_back(sf);
+ }
+ else if(lang[0] == 'C')
{
clCompile.push_back(sf);
}
@@ -468,10 +472,6 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
{
customBuild.push_back(sf);
}
- else if(header)
- {
- headers.push_back(sf);
- }
else if(sf->GetExtension() == "idl")
{
idls.push_back(sf);
-----------------------------------
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2011-03-03 18:23 Farid Zaripov New Issue
======================================================================
More information about the cmake-developers
mailing list