[cmake-developers] [CMake 0015355]: cmake 3.1 doesn't know how to select CMAKE_CXX_STANDARD 11 on Mac OS
Mantis Bug Tracker
mantis at public.kitware.com
Thu Jan 15 15:25:46 EST 2015
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=15355
======================================================================
Reported By: Laurent Demailly
Assigned To:
======================================================================
Project: CMake
Issue ID: 15355
Category: CMake
Reproducibility: always
Severity: major
Priority: normal
Status: new
======================================================================
Date Submitted: 2015-01-15 15:25 EST
Last Modified: 2015-01-15 15:25 EST
======================================================================
Summary: cmake 3.1 doesn't know how to select
CMAKE_CXX_STANDARD 11 on Mac OS
Description:
I have a very simple CMakeLists.txt – am using cmake 3.1 to be able to easily
request C++ 11 – it works fine on ubuntu but not on MacOS with Xcode 6 and
command line tools installed:
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.1)
project("Test1" C CXX)
# We need C++ 11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED on)
file(WRITE test1.cpp "int main(int argc, char** argv) {auto x=argc; return x;}")
add_executable(test1 test1.cpp)
$ cmake31 .
-- The C compiler identification is AppleClang 6.0.0.6000056
-- The CXX compiler identification is AppleClang 6.0.0.6000056
-- Check for working C compiler:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-- Check for working CXX compiler:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
CMake Error in CMakeLists.txt:
Target "test1" requires the language dialect "CXX11" (with compiler
extensions), but CMake does not know the compile flags to use to enable it.
This is with
CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
CXXFLAGS="-std=c++11"
But same without that
Steps to Reproduce:
cmake_minimum_required(VERSION 3.1)
project("Test1" C CXX)
# We need C++ 11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED on)
file(WRITE test1.cpp "int main(int argc, char** argv) {auto x=argc; return x;}")
add_executable(test1 test1.cpp)
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2015-01-15 15:25 Laurent DemaillyNew Issue
======================================================================
More information about the cmake-developers
mailing list