"no known features for CXX compiler" when compiling with MSVC++ 2013
Asked Answered
L

1

4

I have a relatively simple CMakeLists.txt that contains the following line(s):

target_compile_features(myapp PRIVATE
    cxx_generalized_initializers
    cxx_lambdas
    cxx_nullptr)

When I run cmake on a Windows 2012 Server with MSVC++ 2013 Express installed, I get the following error:

CMake Error at CMakeLists.txt:61 (target_compile_features):
  target_compile_features no known features for CXX compiler

  "MSVC"

  version 18.0.30723.0.

What is causing this error, and what can I do about it? CMake doesn't seem to have any problems when I build the project in Ubuntu 14.10 with GCC.

I am using CMake 3.1.0, in case that helps (it was the first CMake release to support target_compile_features).

Lassa answered 23/1, 2015 at 22:9 Comment(0)
L
4

CMake 3.1.0 only supports 'compile features' for GCC 4.7+ (on UNIX but not APPLE) and Clang (but not AppleClang) 3.4+.

CMake 3.2.0 will extend the support to GCC 4.4+ (on UNIX, including APPLE), AppleClang 4.0+ (Xcode 4.4+), SolarisStudio 12.4 and MSVC 2010+.

Patches and maintenance for other compilers can be sent to the cmake mailing list.

Make sure CMP0025 is NEW if you are on APPLE.

https://cmake.org/cmake/help/v3.6/command/cmake_policy.html

Leilaleilah answered 25/1, 2015 at 12:28 Comment(6)
Thanks! I see that CMake 3.2 is scheduled for release on Feb. 1, so it doesn't look like I'll need to wait long.Lassa
I get this error with CMake 3.3.0 and AppleClang 6.1.0.Devaluation
Seems to have been a bug in CMake 3.3.0. Works with CMake 3.3.1.Devaluation
Also appears to be a bug in 3.7.1Hip
@Hip hi, any more information about the bug in 3.7.1? has it been confirmed?Gunnel
cmake - 3.8.1, Apple Clang - 8.1.0 same issueMylor

© 2022 - 2024 — McMap. All rights reserved.