View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015550CMakeCMakepublic2015-05-01 13:262015-11-02 09:15
ReporterDaniel Schepler 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionduplicate 
PlatformDebianOSLinuxOS Versionstretch
Product VersionCMake 3.2.2 
Target VersionFixed in Version 
Summary0015550: check_cxx_source_compiles() does not honor CMAKE_CXX_STANDARD
DescriptionIn a project I recently converted to use set(CMAKE_CXX_STANDARD 11) instead of the previous hard coding of -std=* compile flags in cxx_flag_overrides.cmake, I just noticed that our test for std::unordered_map<> broke.
Steps To Reproduceset(CMAKE_CXX_STANDARD 11)
check_cxx_source_compiles(
"#include <unordered_map>

int main() {
    std::unordered_map<int, int> m;
    return m.size();
}"
    HAVE_STD_UNORDERED_MAP)
Additional InformationI can work around that with set(CMAKE_REQUIRED_FLAGS ${CMAKE_CXX11_EXTENSION_COMPILE_OPTION}) . That seems a bit ugly, though.

I'm not sure what a proper "fix" to this would be. My ideas would be adding *_STANDARD arguments to try_compile() which might not quite be scalable; or maybe having check_cxx_source_compiles add -DCMAKE_CXX_STANDARD=... to the CMAKE_FLAGS it passes to try_compile(), based on CMAKE_CXX_STANDARD which could be overridden by setting CMAKE_REQUIRED_CXX_STANDARD which also seems like it might not be the best possible solution.
TagsNo tags attached.
Attached Files

 Relationships
duplicate of 0015361closedKitware Robot CHECK_CXX_SOURCE_COMPILES doesn't use c++11 flags specified 

  Notes
(0038675)
Brad King (manager)
2015-05-01 13:30

See 0015361:0037760.
(0039799)
Robert Maynard (manager)
2015-11-02 09:15

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

 Issue History
Date Modified Username Field Change
2015-05-01 13:26 Daniel Schepler New Issue
2015-05-01 13:29 Brad King Relationship added duplicate of 0015361
2015-05-01 13:30 Brad King Note Added: 0038675
2015-05-01 13:30 Brad King Status new => resolved
2015-05-01 13:30 Brad King Resolution open => duplicate
2015-11-02 09:15 Robert Maynard Note Added: 0039799
2015-11-02 09:15 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team