leetal / ios-cmake

A CMake toolchain file for iOS, macOS, watchOS & tvOS C/C++/Obj-C++ development
BSD 3-Clause "New" or "Revised" License
1.82k stars 435 forks source link

Set CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD based on selected CMAKE_CXX_STANDARD #204

Open EduMenges opened 3 weeks ago

EduMenges commented 3 weeks ago

This is an issue that has been opened for 4+ years on CMake.

Adding it to the toolchain is a workaround until CMake finally "fixes" it.

In most cases, simply adding set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++${CMAKE_CXX_STANDARD}") works, tho it will not work with GNU extensions.

The same can be done for C_STANDARD.

kambala-decapitator commented 3 weeks ago

tho it will not work with GNU extensions

you should use gnu++${CMAKE_CXX_STANDARD}