View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011925CMakeCMakepublic2011-03-03 18:232011-10-03 09:54
ReporterFarid Zaripov 
Assigned ToDavid Cole 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSWindowsOS Version
Product VersionCMake 2.8.4 
Target VersionCMake 2.8.5Fixed in VersionCMake 2.8.5 
Summary0011925: Visual Studio 2010 Generator mixing ClInclude and ClCompile tags for the same file
DescriptionIf 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 Reproduce1. 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 InformationThe 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);
-----------------------------------
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0026588)
David Cole (manager)
2011-05-25 16:53

Fix pushed to next:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6b52bd8ef82d015231b426ac2d0a1e84ee3a823 [^]

...in CMake 2.8.5-rc1 release candidate.
(0027507)
David Cole (manager)
2011-10-03 09:54

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2011-03-03 18:23 Farid Zaripov New Issue
2011-03-04 10:28 David Cole Assigned To => David Cole
2011-03-04 10:28 David Cole Status new => assigned
2011-03-04 10:28 David Cole Target Version => CMake 2.8.5
2011-05-19 12:14 Bill Hoffman Assigned To David Cole => Bill Hoffman
2011-05-25 16:52 David Cole Assigned To Bill Hoffman => David Cole
2011-05-25 16:53 David Cole Note Added: 0026588
2011-05-25 16:53 David Cole Status assigned => resolved
2011-05-25 16:53 David Cole Fixed in Version => CMake 2.8.5
2011-05-25 16:53 David Cole Resolution open => fixed
2011-10-03 09:54 David Cole Note Added: 0027507
2011-10-03 09:54 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team