MantisBT - CMake
View Issue Details
0015852CMake(No Category)public2015-11-19 08:452016-06-10 14:21
A. Klitzing 
Brad King 
normalmajoralways
closedfixed 
CMake 3.4 
CMake 3.4.1CMake 3.4.1 
0015852: CMAKE_CXX_STANDARD broken since CMake 3.4.0 for toolchain files using CMakeForceCompiler
We use the Android NDK/SDK and CMake (with Toolchain file [1]) to build our program.
If we build our program with CMake 3.4.0 we will get compiler errors that we need to enable "-std=c++11 or -std=gnu++11". If we switch back to CMake 3.3.2 the flags will be defined by CMake and the build works.

In our cmake files:
    SET(CMAKE_CXX_STANDARD 11)
    SET(CMAKE_CXX_STANDARD_REQUIRED ON)


[1] https://github.com/taka-no-me/android-cmake [^]
-- ANDROID_NDK_RELEASE: r10e
-- ANDROID_ABI: armeabi-v7a
-- ANDROID_NATIVE_API_LEVEL: 18
-- ANDROID_TOOLCHAIN_ROOT: /opt/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
-- ANDROID_SYSROOT: /opt/android-ndk/platforms/android-18/arch-arm
-- ANDROID_TOOLCHAIN_NAME: arm-linux-androideabi-4.9
No tags attached.
has duplicate 0016004closed  CMAKE_CXX_STANDARD and CMAKE_CXX_EXTENSIONS not working for crosscompilers 
Issue History
2015-11-19 08:45A. KlitzingNew Issue
2015-11-19 08:59Brad KingTarget Version => CMake 3.4.1
2015-11-19 09:46Brad KingNote Added: 0039882
2015-11-19 09:50Brad KingNote Added: 0039883
2015-11-19 09:50Brad KingTarget VersionCMake 3.4.1 =>
2015-11-19 09:52Brad KingOSAndroid NDK =>
2015-11-19 09:52Brad KingPlatformAndroid =>
2015-11-19 09:52Brad KingSummaryCMAKE_CXX_STANDARD broken since CMake 3.4.0 for Android => CMAKE_CXX_STANDARD broken since CMake 3.4.0 for toolchain files using CMakeForceCompiler
2015-11-19 10:27Brad KingNote Added: 0039884
2015-11-19 10:27Brad KingNote Added: 0039885
2015-11-19 10:27Brad KingAssigned To => Brad King
2015-11-19 10:27Brad KingStatusnew => resolved
2015-11-19 10:27Brad KingResolutionopen => fixed
2015-11-19 10:27Brad KingFixed in Version => CMake 3.4.1
2015-11-19 10:27Brad KingTarget Version => CMake 3.4.1
2016-03-04 04:36Rolf Eike BeerRelationship addedhas duplicate 0016004
2016-06-10 14:21Kitware RobotNote Added: 0041237
2016-06-10 14:21Kitware RobotStatusresolved => closed

Notes
(0039882)
Brad King   
2015-11-19 09:46   
Bisects to here:

 Project: Don't require computed default dialect if compiler was forced.
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d1375851 [^]
(0039883)
Brad King   
2015-11-19 09:50   
See discussion here:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/14410/focus=14490 [^]

Basically CMakeForceCompiler cannot be used with compile features or CXX_STANDARD reliably. AFAIK there is no reason that the Android compilers need to be enabled using CMakeForceCompiler. The toolchain file should be taught not to use it.
(0039884)
Brad King   
2015-11-19 10:27   
As discussed in the thread linked in 0015852:0039883, CMakeForceCompiler has been deprecated in post-3.4 CMake development:

 CMakeForceCompiler: Deprecate this module and its macros
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ed77504d [^]

Therefore toolchain files should be ported away from using CMakeForceCompiler.

Meanwhile I've fixed the immediate issue:

 Project: Guess default standard dialect if compiler was forced
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=441dba80 [^]
(0039885)
Brad King   
2015-11-19 10:27   
I've queued this fix for merge to 'release' for inclusion in 3.4.1.
(0041237)
Kitware Robot   
2016-06-10 14:21   
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.