CMake 3.16 must not apply C++ flags to ObjectiveC files
Hello,
CMake 3.16.0-rc1 breaks compilation of ObjectiveC files by applying C++ compiler flags:
cmake_minimum_required(VERSION 3.15.1 FATAL_ERROR)
project(testcase)
string(APPEND CMAKE_CXX_FLAGS " -std=c++11")
set(CMAKE_CXX_STANDARD 14)
add_library(somelib main.m)
This results in the following compiler output:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -std=c++11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.14 -std=gnu++14 -MD -MT CMakeFiles/somelib.dir/main.m.o -MF CMakeFiles/somelib.dir/main.m.o.d -o CMakeFiles/somelib.dir/main.m.o -c ../main.m
error: invalid argument '-std=gnu++14' not allowed with 'Objective-C'
Thanks, Gregor