MantisBT - CMake
View Issue Details
0015355CMakeCMakepublic2015-01-15 15:252015-06-01 08:38
Laurent Demailly 
Stephen Kelly 
normalmajoralways
closedfixed 
Apple MacOS X10.4.10
CMake 3.1 
CMake 3.2CMake 3.2 
0015355: cmake 3.1 doesn't know how to select CMAKE_CXX_STANDARD 11 on Mac OS
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
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)

No tags attached.
Issue History
2015-01-15 15:25Laurent DemaillyNew Issue
2015-01-15 15:35Brad KingNote Added: 0037707
2015-01-15 15:35Brad KingStatusnew => acknowledged
2015-01-15 15:35Brad KingTarget Version => CMake 3.2
2015-01-16 19:38Laurent DemaillyNote Added: 0037726
2015-01-17 12:28Brad KingNote Added: 0037730
2015-01-17 12:28Brad KingAssigned To => Stephen Kelly
2015-01-17 12:28Brad KingStatusacknowledged => resolved
2015-01-17 12:28Brad KingResolutionopen => fixed
2015-01-17 12:28Brad KingFixed in Version => CMake 3.2
2015-01-19 17:00Laurent DemaillyNote Added: 0037750
2015-06-01 08:38Robert MaynardNote Added: 0038847
2015-06-01 08:38Robert MaynardStatusresolved => closed

Notes
(0037707)
Brad King   
2015-01-15 15:35   
CMake 3.1 was not taught about OS X compilers. I think this has been done in post-3.1 development:

 Record compile features for GNU on Apple.
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=00f66a04 [^]

 Features: Record dialect flags for AppleClang 4.0+.
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98965fb1 [^]

 Features: Record for AppleClang 5.1
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bd6b42c1 [^]

Please try building from source in the 'master' branch as of commit '811a29c9' or later.
(0037726)
Laurent Demailly   
2015-01-16 19:38   
Thank you ! that worked - I have some other issues that came up after that - will file other reports

Question though : when can I expect to see these fixed ? will it be 3.1.1 and what is the ETA for that ?

Thanks a lot
Laurent
(0037730)
Brad King   
2015-01-17 12:28   
Re 0015355:0037726: These will not be in 3.1.1 which is just for regression fixes from 3.1.0. This is scheduled for 3.2.

You could also build from source or use nightly binaries:

 http://www.cmake.org/files/dev/?C=M;O=D [^]

> I have some other issues that came up after that - will file other reports

As these are brand new features still under development it would be better to discuss them on the mailing list:

 http://www.cmake.org/mailman/listinfo/cmake-developers [^]
(0037750)
Laurent Demailly   
2015-01-19 17:00   
yes I built from source and that fixed it - any eta for 3.2 ?
CMAKE_CXX_STANDARD 11 is why I picked cmake 3.1 so it's a bit of a bummer it doesn't work
on macos (which is also why I picked cmake, to get xcode and other IDEs support in addition to unix makefiles)

in other word - any way to consider that lack of a implementation a bug for 3.1 and put this in 3.1.1 ?
(or then again get 3.2 soonish)


The other issues I filled 2 separate tickets so far
(0038847)
Robert Maynard   
2015-06-01 08:38   
Closing resolved issues that have not been updated in more than 4 months.