Notes |
|
(0020794)
|
Thomas Laguzzi
|
2010-05-20 02:16
|
|
I have successfully done a patch to 2.8.1
I could publish it, but I don't know the used conventions for these cases. I should use a global variable?
It would be better a flag variable or a value variable.
Like
SET(VS_USE_PLATFORM_V90 "1")
or
SET(VS_PLATFORM_TOOLSET "v90")
also, how this applies to targets? |
|
|
(0020845)
|
Brad King
|
2010-05-27 13:41
|
|
Interesting. It is easy to put the <PlatformToolset> element in the project files, but there is a lot more involved for this feature.
(1) CMake has a 10 year history with a one-to-one mapping between VS generators and VS versions. Tests like if(MSVC90) have been written both for recognizing the VS IDE version and the compiler version. There is no distinction. Even if the project to be built contains no such tests, CMake's own modules do contain some.
(2) CMake's VS generators map from user-specified compiler flags to the IDE project file XML elements and attributes. This mapping is specific to the VS version because the IDE internally maps them back to flags during the build. It is not clear how this mapping is affected by the PlatformToolset option.
(3) By convention, CMake projects generally adapt to the compiler environment specified by the user at configuration and build time. There must be a way to select the compiler without modifying the project source code or CMakeLists.txt files. (Note also that the global MFC selection variable is left from an ancient interface design that we no longer use for new features.)
These concerns are off the top of my head. Unfortunately I think this is a big can of worms. Anyone who investigates this further will doubtlessly find additional roadblocks. |
|
|
(0020881)
|
Thomas Laguzzi
|
2010-06-01 02:39
|
|
Your considerations are totally right , but I'd like to suggest to not ignore this aspect because this is something that future visual studio version will continue to have and people will start using it. A similar feature allows to use a newer (and presumably better) IDE with an estabilished compiler set. For example, we'd like to use it because VS 2010 has better intellisense.
Surely this a big feature to implement, and it will work only by adding a specific support.
Just to add some considerations:
(1) and (2) - Teorically you should use the VC2010 XML mapping, but the ABI and compiler features should be tested with the previous version. I don't know how compiler detection works, but if you enable the flag during the ABI detection there should be no problems, the compiler will automatically report the feature level of the previous version.
(3) - Could be there an additional generator that sets the <PlatformToolset>?
--
(sorry for my bad english) |
|
|
(0020917)
|
Brad King
|
2010-06-03 13:19
(edited on: 2010-06-03 13:20) |
|
Currently I have no time to investigate this further, but I have a few more thoughts to record for anyone who investigates it:
This may not be quite as hard as I previously thought:
(a) This affects only the VS 10 generator and generators for future VS versions.
(b) Platform variables like MSVC90 can be set based on the actual compiler while the generator name reflects the IDE version. This may be a reasonable distinction.
(c) If the user does not ask for PlatformToolset to be used the behavior is unchanged so existing cases will still work.
I think the tricky part for the interface design is concern (3) I mentioned previously. Previously CMake only supported compiler specification for Makefile generators. Other generators (VS, Xcode) assume a single IDE <-> compiler correspondence. There is already an open problem for specifying the compiler used by Xcode projects. Whatever solution we use should work for both VS and Xcode.
|
|
|
(0020918)
|
Brad King
|
2010-06-03 13:21
|
|
Issue 0009125 requests compiler selection for Xcode. The interface added by the current fix for that issue to set GCC_VERSION is very Xcode-specific. Something more general will be needed for both. |
|
|
(0021526)
|
RolandSchulz
|
2010-07-28 15:11
|
|
Compiling x64 binaries with VC10 express requires to also install SDK 7.1 and choosing the Windows7.1SDK as Platform toolset. Because Cmake doesn't allow to specify the toolset one has to run cmake after running the SetEnv.Cmd (part of the SDK) which makes the SDK the default toolset. Because Cmake doesn't record the used toolset, if one compiles in VC10 without the SetEnv.CMD run first, the toolset doesn't match with that used to configure the compiler.
To summarize:
- Because cmake doesn't allow to select a toolset it is difficult to compile x64 with VC express
- Because cmakes doesn't record the used toolset the toolset might not be correct if the enviormnet variables are different.
Thus it would be very helpful if cmake supports selecting toolset and would record the toolset used for configuring. |
|
|
(0023645)
|
Brad King
|
2010-12-01 13:50
|
|
I've added support for setting PlatformToolset to "Windows7.1SDK" specifically when the Visual Studio 10 Win64 generator detect the Express edition of the compiler:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fb97ba62 [^]
When the generator detects this compiler it now looks for the Windows SDK v7.1. If not found it produces a straightforward error message.
This change enables 64-bit builds with VS 2010 Express but avoids opening the can of worms discussed above with allowing different compiler versions to be used. |
|
|
(0027512)
|
ahoros
|
2011-10-03 10:54
|
|
Hello Thomas,
What is the status of your patch?
I am trying to use Visual Studio 11 with CMake 2.8.5
and it fails because cmake (cmake -G "Visual Studio 10")
is passing (?) toolset v100 which results in this problem:
--------------------
-- Check for working C compiler using: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10 -- broken
CMake Error at c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "c:/Program Files (x86)/Microsoft Visual Studio
11.0/VC/bin/cl.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/BAZAAR/buildVC11/CMakeFiles/CMakeTmp
Run Build Command:C:\PROGRA~2\MICROS~1.0\Common7\IDE\devenv.com
CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec
Microsoft (R) Visual Studio 11 Version 11.0.40825.2.
Copyright (C) Microsoft Corp. All rights reserved.
The evaluation period for Visual Studio Trial ends in 270 days.
1>------ Build started: Project: cmTryCompileExec, Configuration: Debug
Win32 ------
1>Build started 2011-10-03 16:29:48.
1>C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\Win32\Microsoft.Cpp.Win32.Targets(32,5):
error MSB8008: Specified platform toolset (v100) is not installed or
invalid. Please make sure that a supported PlatformToolset value is
selected.
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.02
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (PROJECT)
-----------------------------------------
or in general how can I generate make files for VC11 ? |
|
|
(0028314)
|
Brad King
|
2012-01-16 08:40
|
|
|
|
(0032229)
|
Brad King
|
2013-02-08 13:49
|
|
A new "generator toolset" feature has been added here:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7dab9977 [^]
One may now run CMake from the command line with
-G "Visual Studio 10" -T "v90"
in order to build with a specific toolset. We've not yet added a first-class interface to cmake-gui for this, but one may add the cache entry "CMAKE_GENERATOR_TOOLSET" to contain the "-T" value before configuring.
|
|
|
(0033416)
|
Robert Maynard
|
2013-07-01 09:36
|
|
Closing resolved issues that have not been updated in more than 4 months. |
|