[cmake-developers] [CMake 0015443]: Unable to use target_compile_features with MinGW-w64
Mantis Bug Tracker
mantis at public.kitware.com
Fri Mar 13 04:42:32 EDT 2015
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=15443
======================================================================
Reported By: David Demelier
Assigned To:
======================================================================
Project: CMake
Issue ID: 15443
Category: CMake
Reproducibility: always
Severity: major
Priority: high
Status: new
======================================================================
Date Submitted: 2015-03-13 04:42 EDT
Last Modified: 2015-03-13 04:42 EDT
======================================================================
Summary: Unable to use target_compile_features with MinGW-w64
Description:
The following CMakeLists.txt generates an error on MinGW-w64:
cmake_minimum_required(VERSION 3.2)
project(test)
add_executable(main main.cpp)
target_compile_features(
main
PRIVATE
cxx_constexpr
)
This is the error:
CMake Error at CMakeLists.txt:6 (target_compile_features):
target_compile_features no known features for CXX compiler
"GNU"
version 4.9.2.
Steps to Reproduce:
1. Try to use target_compile_features with MinGW-w64
Additional Information:
It seems that Modules/Compiler/GNU-CXX.cmake has useless UNIX conditionals:
Changing lines 47 and 50 to the following fix the problem:
set(_result 0)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
_get_gcc_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION}
CMAKE_CXX14_COMPILE_FEATURES)
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
if (_result EQUAL 0)
_get_gcc_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION}
CMAKE_CXX11_COMPILE_FEATURES)
endif()
if (_result EQUAL 0)
_get_gcc_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION}
CMAKE_CXX98_COMPILE_FEATURES)
endif()
endif()
Please note that MinGW-w64 fully supports C++11 and C++14.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2015-03-13 04:42 David Demelier New Issue
======================================================================
More information about the cmake-developers
mailing list