Reputation: 1028
My C++11 project is currently using CMAKE, XCODE, CLANG on OSX. I wish to compile this code on Windows.
Plan is to use the same cmake settings files on windows. Best case would be to use CMAKE to generate VS projects which uses Clang or gcc for C++11 .
Seems to me, that Visual Studio is just not going to fully support C++11 for a while. So we should all try to find a general solution for cross platform C++11.
How would one use CMAKE to generate projects/makefiles which would compile C++11 code on windows?
Upvotes: 0
Views: 2147
Reputation: 54589
CMake's Visual Studio generator will always use the cl
compiler of Visual C++.
What you request would require writing a new Generator for CMake. That is, the problem cannot be solved by writing a clever CMakeLists.txt
, but has to be solved by adding a feature to the CMake core binary itself. I agree that this could be useful once Clang achieves a suitable level of Windows support, but at the point of this writing, it is probably too early for that.
You might want to take a look at the experimental compile-features
mechanism for CMake. This is not yet part of CMake 3.0, but is planned to be integrated with one of the next releases. The idea is that you just specify which C++11 features you need and CMake takes care of configuring the compiler accordingly (or gives an error if the compiler does not support the feature at all).
Upvotes: 1
Reputation: 11074
You can create VS projects which use clang by specifying the LLVM toolset when you generate.
http://public.kitware.com/Bug/view.php?id=14863
Eg:
cmake.exe .. -T LLVM-vs2010
Upvotes: 1