使用 cmake 配置的 Visual Studio 项目中的 C++11 指令编译器失败

Compiler failing on C++11 instructions in a Visual Studio project configured with cmake

我正在尝试在 Visual Studio 2012 的 64 位 Windows 机器上构建 voxelterrain 库(C++,Ogre)。CMake 似乎 运行 没有错误(见输出以下)。当我尝试编译库时,我收到了几个错误。我不知道 CMAKE,但我假设编译器没有正确解释 C++11。

例如: 此代码...

 template <class T>
    using weakPointer = std::weak_ptr<T>;

出现此错误:

error C2988: Unerkannte Vorlagendeklaration/-definition
error C2059: syntax error : 'using'
error C2143: syntax error : missing ';' before '{'
error C2447: '{': missing function header (old-style formal list?

这里是源代码和 CMAKE 文件:

体素地形库:http://voxelterrain.com/index.html

CMake 文件:https://github.com/qwertzui11/voxelTerrain/blob/master/CMakeLists.txt

CMake 输出:

The C compiler identification is MSVC 17.0.61030.0
The CXX compiler identification is MSVC 17.0.61030.0
Check for working C compiler using: Visual Studio 11 2012 Win64
Check for working C compiler using: Visual Studio 11 2012 Win64 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 11 2012 Win64
Check for working CXX compiler using: Visual Studio 11 2012 Win64 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
 CMake Warning (dev) at CMakeLists.txt:20 (if):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:26 (elseif):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

Boost version: 1.57.0
...
Looking for OGRE...
Found Ogre Xalafu (1.10.0) 
...
Performing Test COMPILER_HAS_DEPRECATED_ATTR
Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
Performing Test COMPILER_HAS_DEPRECATED
Performing Test COMPILER_HAS_DEPRECATED - Success
...
Configuring done
Generating done

感谢您的帮助!

This article 表示 Visual Studio 2012 不支持别名模板。

它们在 Visual Studio 2013 年得到支持。