MantisBT - CMake
View Issue Details
0015861CMakeCMakepublic2015-11-25 01:042016-05-02 08:30
Ruslan Baratov 
Brad King 
normalminoralways
closedfixed 
OS X 10.11
CMake 3.4 
CMake 3.4.1CMake 3.4.1 
0015861: Configuration with -flto flag failed: CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for AppleClang [3.4 regression]
Not able to configure project with CMAKE_CXX_FLAGS=-flto and CMAKE_CXX_COMPILER=clang++. Works fine for CMake 3.3.
Example:

> cat CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
project(Foo)

> cmake --version
cmake version 3.4.0

> /usr/bin/clang++ --version
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin15.0.0
Thread model: posix

> cmake -H. -B_builds -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_CXX_FLAGS=-flto
...
CMake Error at .../share/cmake-3.4/Modules/Compiler/AppleClang-CXX.cmake:28 (message):
  CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for AppleClang
  (/usr/bin/clang++) version 6.1.0.6020053
No tags attached.
Issue History
2015-11-25 01:04Ruslan BaratovNew Issue
2015-11-30 09:30Brad KingNote Added: 0039917
2015-11-30 09:30Brad KingAssigned To => Brad King
2015-11-30 09:30Brad KingStatusnew => resolved
2015-11-30 09:30Brad KingResolutionopen => fixed
2015-11-30 09:30Brad KingFixed in Version => CMake 3.4.1
2015-11-30 09:30Brad KingTarget Version => CMake 3.4.1
2015-11-30 13:15Brad KingNote Added: 0039924
2015-12-01 03:37Ruslan BaratovNote Added: 0039925
2016-05-02 08:30Robert MaynardNote Added: 0040973
2016-05-02 08:30Robert MaynardStatusresolved => closed

Notes
(0039917)
Brad King   
2015-11-30 09:30   
This was fixed recently here:

 Make C and C++ default dialect detection robust to advanced optimizations
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c3dc8935 [^]

and has been merged to 'release' for inclusion in 3.4.1.
(0039924)
Brad King   
2015-11-30 13:15   
Corresponding mailing list thread:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/14984 [^]
(0039925)
Ruslan Baratov   
2015-12-01 03:37   
Version from branch 'next' with c3dc8935 commit works fine, thanks.
(0040973)
Robert Maynard   
2016-05-02 08:30   
Closing resolved issues that have not been updated in more than 4 months.