View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015443CMakeCMakepublic2015-03-13 04:422016-05-02 08:30
ReporterDavid Demelier 
Assigned ToBrad King 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSWindowsOS Version7
Product VersionCMake 3.2.1 
Target VersionCMake 3.3Fixed in VersionCMake 3.3 
Summary0015443: Unable to use target_compile_features with MinGW-w64
DescriptionThe 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 Reproduce1. Try to use target_compile_features with MinGW-w64
Additional InformationIt 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.
TagsNo tags attached.
Attached Files

 Relationships
related to 0015727closedBrad King Support C compiler features for GNU on windows 
related to 0015897closedBrad King Clang CXX feature detection disabled on WIN32 platforms 

  Notes
(0038233)
Brad King (manager)
2015-03-17 14:37

I've removed the UNIX conditional. It works for me in local testing with a MinGW GNU 4.6.2 compiler.

 Record compile features for GNU on Windows
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f94727a9 [^]
(0040994)
Robert Maynard (manager)
2016-05-02 08:30

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-03-13 04:42 David Demelier New Issue
2015-03-13 08:24 Brad King Target Version => CMake 3.3
2015-03-17 14:37 Brad King Note Added: 0038233
2015-03-17 14:37 Brad King Assigned To => Brad King
2015-03-17 14:37 Brad King Status new => resolved
2015-03-17 14:37 Brad King Resolution open => fixed
2015-03-17 14:37 Brad King Fixed in Version => CMake 3.3
2015-09-09 09:28 Brad King Relationship added has duplicate 0015727
2015-09-09 09:29 Brad King Relationship replaced related to 0015727
2016-01-07 15:05 Brad King Relationship added related to 0015897
2016-05-02 08:30 Robert Maynard Note Added: 0040994
2016-05-02 08:30 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team