The following issue has been SUBMITTED. ====================================================================== http://www.cmake.org/Bug/view.php?id=15550 ====================================================================== Reported By: Daniel Schepler Assigned To: ====================================================================== Project: CMake Issue ID: 15550 Category: CMake Reproducibility: always Severity: minor Priority: normal Status: new ====================================================================== Date Submitted: 2015-05-01 10:26 PDT Last Modified: 2015-05-01 10:26 PDT ====================================================================== Summary: check_cxx_source_compiles() does not honor CMAKE_CXX_STANDARD Description: In 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 Reproduce: set(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 Information: I 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. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2015-05-01 10:26 Daniel ScheplerNew 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