View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014493CMakeCMakepublic2013-10-18 08:452014-06-02 08:39
Reportermar-na 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionCMake 3.0Fixed in VersionCMake 3.0 
Summary0014493: Document relationship of VS_KEYWORD and VS_GLOBAL_KEYWORD
DescriptionI want set the Visual Studio project keyword for a managed project to ManagedCProj. I use VS 2008.
I found the target property VS_GLOBAL_KEYWORD. It was added in Issue 0012586. But this only works for VS 2010 and not for VS 2008.
In the source code is this only added in cmVisualStudio10TargetGenerator.

Is cmLocalVisualStudio7Generator the right place to fix it?
There I found VS_KEYWORD. Is this the same?

cmLocalVisualStudio7Generator:
const char* keyword = target.GetProperty("VS_KEYWORD");
  if(!keyword)
    {
    keyword = "Win32Proj";
    }
    
from cmVisualStudio10TargetGenerator:
  const char* vsGlobalKeyword =
    this->Target->GetProperty("VS_GLOBAL_KEYWORD");
  if(!vsGlobalKeyword)
    {
    this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2);
    }
  else
    {
    this->WriteString("<Keyword>", 2);
    (*this->BuildFileStream) << cmVS10EscapeXML(vsGlobalKeyword) <<
      "</Keyword>\n";
    }
Steps To Reproduceset_target_properties(myTarget PROPERTIES VS_GLOBAL_KEYWORD "ManagedCProj")
TagsNo tags attached.
Attached Filespatch file icon Fix-target-property-for-visual-Studio-project-keyword.patch [^] (2,692 bytes) 2013-10-21 05:22 [Show Content]
? file icon vs2008-managed_cpp_dotnet_2.vcproj [^] (5,346 bytes) 2013-10-21 11:17

 Relationships
related to 0012586closedBrad King [patch] CMake does not support Visual Studio projects types or dotnet references with managed C++ 
related to 0008707closedDavid Cole Add support for global variables in Visual Studio generator 

  Notes
(0034151)
Brad King (manager)
2013-10-18 09:13

Yes, it looks like these are the same except VS_KEYWORD is for VS < 10 and VS_GLOBAL_KEYWORD is for VS >= 10. It looks like VS_KEYWORD was added here:

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

but was left out of the original VS 10 generator implementation. Then VS_GLOBAL_KEYWORD was added here:

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

for VS 10 and no one noticed that VS_KEYWORD should have been there.
(0034152)
Brad King (manager)
2013-10-18 09:15

It looks like VS_KEYWORD also has meaning for Fortran targets when generating the .vfproj files for the Intel Fortran VS plugin.
(0034177)
mar-na (reporter)
2013-10-21 05:22

Try to resolve: Fix-target-property-for-visual-Studio-project-keyword.patch
Tested with VS 2008 and VS 2010.

Marked VS_GLOBAL_KEYWORD as obsolete.

for VS <= 2008:
unchanged

for VS >= 2010:
Use VS_KEYWORD instead of VS_GLOBAL_KEYWORD.
If VS_GLOBAL_KEYWORD was found then use the value for VS_KEYWORD. (for Backward compatibility)
(0034189)
Brad King (manager)
2013-10-21 10:04

The current behavior has been status-quo since 2.8.7 which is almost two years old now. I like the name VS_GLOBAL_KEYWORD better for VS 10 because it is grouped with other Global values in the msbuild project file set by VS_GLOBAL_* properties. I think it is better to just document the current behavior (which is for which version).
(0034191)
Brad King (manager)
2013-10-21 10:23

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b9fe4b63 [^]
(0034200)
mar-na (reporter)
2013-10-21 10:49

Only a question. (Sorry if it is not allowed to reopen it for additional questions)

Should I allways added this in me CMakeList.txt files:

# sets the "keyword" attribute in the project file
if(MSVC_VERSION LESS 1600) # For < VS 2010
  set_target_properties(MyTarget PROPERTIES VS_KEYWORD "ManagedCProj")
else() # For >= VS 2010
  set_target_properties(MyTarget PROPERTIES VS_GLOBAL_KEYWORD "ManagedCProj")
(0034202)
Brad King (manager)
2013-10-21 10:54

There is no reason not to set a property that will not be used so you can do just

 set_target_properties(MyTarget PROPERTIES
   VS_KEYWORD "ManagedCProj" # < VS 2010
   VS_GLOBAL_KEYWORD "ManagedCProj" # >= VS 2010
   )
(0034206)
mar-na (reporter)
2013-10-21 11:16

Sorry again

If I set VS_GLOBAL_KEYWORD in a VS 2008 project then I get it additional in the section global. But is this right?
When I create I Managed C++ Project direct with VS 2008 then it set only the Key attribut but do not added it to the global section.

<Globals>
</Globals>
(0034207)
Brad King (manager)
2013-10-21 11:19

Ugh, that's hitting this:

http://www.cmake.org/cmake/help/v2.8.12/cmake.html#prop_tgt:VS_GLOBAL_variable [^]
(0034208)
mar-na (reporter)
2013-10-21 11:22

Add file wich was self generated with VS 2008.

When it was generated with CMake. I get this:
<Globals>
    <Global
        Name="KEYWORD"
        Value="ManagedCProj"
    />
</Globals>
(0034209)
mar-na (reporter)
2013-10-21 11:23

Sorry. It was auto assign. How could I revert this??
(0034210)
Brad King (manager)
2013-10-21 11:25

This is a long-existing conflict between the old VS 2008 generator feature and the new VS 2010 VS_GLOBAL_* properties. Does the extra Global hurt anything?
(0036094)
Robert Maynard (manager)
2014-06-02 08:39

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

 Issue History
Date Modified Username Field Change
2013-10-18 08:45 mar-na New Issue
2013-10-18 09:08 Brad King Relationship added related to 0012586
2013-10-18 09:13 Brad King Note Added: 0034151
2013-10-18 09:15 Brad King Note Added: 0034152
2013-10-21 05:22 mar-na File Added: Fix-target-property-for-visual-Studio-project-keyword.patch
2013-10-21 05:22 mar-na Note Added: 0034177
2013-10-21 10:04 Brad King Note Added: 0034189
2013-10-21 10:23 Brad King Note Added: 0034191
2013-10-21 10:23 Brad King Assigned To => Brad King
2013-10-21 10:23 Brad King Status new => resolved
2013-10-21 10:23 Brad King Resolution open => fixed
2013-10-21 10:23 Brad King Fixed in Version => CMake 3.0
2013-10-21 10:23 Brad King Target Version => CMake 3.0
2013-10-21 10:23 Brad King Summary Could not set Visual Studio project keyword with VS_GLOBAL_KEYWORD and VS 2008 => Document relationship of VS_KEYWORD and VS_GLOBAL_KEYWORD
2013-10-21 10:49 mar-na Note Added: 0034200
2013-10-21 10:49 mar-na Status resolved => feedback
2013-10-21 10:49 mar-na Resolution fixed => reopened
2013-10-21 10:54 Brad King Note Added: 0034202
2013-10-21 10:55 Brad King Status feedback => resolved
2013-10-21 10:55 Brad King Resolution reopened => fixed
2013-10-21 11:16 mar-na Note Added: 0034206
2013-10-21 11:16 mar-na Status resolved => feedback
2013-10-21 11:16 mar-na Resolution fixed => reopened
2013-10-21 11:17 mar-na File Added: vs2008-managed_cpp_dotnet_2.vcproj
2013-10-21 11:19 Brad King Note Added: 0034207
2013-10-21 11:21 Brad King Relationship added related to 0008787
2013-10-21 11:22 Brad King Relationship deleted related to 0008787
2013-10-21 11:22 Brad King Relationship added related to 0008708
2013-10-21 11:22 Brad King Relationship deleted related to 0008708
2013-10-21 11:22 mar-na Note Added: 0034208
2013-10-21 11:22 mar-na Status feedback => assigned
2013-10-21 11:22 Brad King Relationship added related to 0008707
2013-10-21 11:23 mar-na Note Added: 0034209
2013-10-21 11:25 Brad King Note Added: 0034210
2014-01-27 13:51 Brad King Status assigned => resolved
2014-01-27 13:51 Brad King Resolution reopened => fixed
2014-06-02 08:39 Robert Maynard Note Added: 0036094
2014-06-02 08:39 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team