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                                    
======================================================================

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to