View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0016014CMakeCMakepublic2016-03-12 11:472016-06-10 14:21
ReporterNikolai 
Assigned To 
PriorityurgentSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSWindowsOS VersionWindows 10
Product VersionCMake 3.5 
Target VersionFixed in Version 
Summary0016014: Cannot change "Target Platform Version" in MSVC2015
DescriptionBased on source code for CMake 3.5. Now WindowsTargetPlatformVersion is set using cmGlobalVisualStudio14Generator::GetWindows10SDKVersion() function and there is no way to set it manualy. So it's impossible to build projects using SDK versions other than the latest one.

This feature was added in https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3f077996 [^] It's said that "The :variable:`CMAKE_SYSTEM_VERSION` variable may be set to specify a
 version." But it obviously doesn't work it that case.

I propose to add checking for property CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION already set before trying to get it using GetWindows10SDKVersion(). Example solution is given in patch file attachment. Though I suppose it's not the best way to do it.
TagsNo tags attached.
Attached Filespatch file icon 0001-Try-to-get-CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION-.patch [^] (1,995 bytes) 2016-03-12 11:47 [Show Content]

 Relationships

  Notes
(0040664)
Nikolai (reporter)
2016-03-12 11:58

Also, CMake with the given patch works fine for my purposes.
(0040670)
Brad King (manager)
2016-03-14 10:01

Setting CMAKE_SYSTEM_VERSION is the intended way to configure this value. It must be done either in the toolchain file or with an explicit -DCMAKE_SYSTEM_VERSION= on the first configuration of a build tree.
(0040673)
Nikolai (reporter)
2016-03-14 10:50

I doubt it. Tag WindowsTargetPlatformVersion is written to MSVC project file only in one place:
cmVisualStudio10TargetGenerator.cxx 3289
`
  cmGlobalVisualStudio10Generator* gg =
    static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
...
  std::string const& targetPlatformVersion =
    gg->GetWindowsTargetPlatformVersion();
  if (!targetPlatformVersion.empty())
    {
    this->WriteString("<WindowsTargetPlatformVersion>", 2);
    (*this->BuildFileStream) << cmVS10EscapeXML(targetPlatformVersion) <<
      "</WindowsTargetPlatformVersion>\n";
    }
`
In cmGlobalVisualStudio10Generator class:
`
  std::string const& GetWindowsTargetPlatformVersion() const
    { return this->WindowsTargetPlatformVersion; }
`
The only place WindowsTargetPlatformVersion is assigned to is in cmGlobalVisualStudio14Generator class in function 'bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf, bool required)' where it is searched in register and file system.
(0040676)
Brad King (manager)
2016-03-14 10:54

Yes, and WindowsTargetPlatformVersion is specifically meant to specify the SDK. It needs to specify an existing one or nothing can build. If you specify -DCMAKE_SYSTEM_VERSION= with an exact version of an existing SDK it will be used.
(0040678)
Nikolai (reporter)
2016-03-14 11:11

Ok, my fault. Now I have understood the algorithm. It ony works when setting before the first configuration and there is no way to change it afterwards. It differs from the way other properties work and I got confused.
(0041229)
Kitware Robot (administrator)
2016-06-10 14:21

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2016-03-12 11:47 Nikolai New Issue
2016-03-12 11:47 Nikolai File Added: 0001-Try-to-get-CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION-.patch
2016-03-12 11:58 Nikolai Note Added: 0040664
2016-03-14 10:01 Brad King Note Added: 0040670
2016-03-14 10:01 Brad King Status new => resolved
2016-03-14 10:01 Brad King Resolution open => no change required
2016-03-14 10:50 Nikolai Note Added: 0040673
2016-03-14 10:53 Nikolai Note Added: 0040675
2016-03-14 10:54 Brad King Note Added: 0040676
2016-03-14 11:00 Nikolai Note Deleted: 0040675
2016-03-14 11:11 Nikolai Note Added: 0040678
2016-06-10 14:21 Kitware Robot Note Added: 0041229
2016-06-10 14:21 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team