CMake, select the Xcode compiler

I know that until recently it was not possible to select any specific compiler for xcode projects generated by CMake (he always chose the default xcodes compiler). In any case, this message: http://cmake.3232098.n2.nabble.com/CMake-2-8-1-available-for-download-td4752230.html makes me believe that this is possible using the special CMAKE_XCODE_ATTRIBUTE _ . Unfortunately, I could not find which flag the xcodes compiler should change, as well as a list of all xcode flags supported by CMake.

I am using Xcode 4.2 and CMake 2.8.6, and I would like to be able to switch between LLVM 3.0 and LLVM GCC 4.2 from CMake.

As I said, the list that lists all the xcode flags that I can change from CMake will be great!

thanks

EDIT:

with Cmake 2.8.6, if you want to generate an xcode project that does not have a default for Clang / LLVM 3.0, use the following:

set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42") 
+6
source share
1 answer

It seems that CMake simply transparently sets any attribute that you set in the Xcode project file, so it supports any attributes that you like.

When checking one of my GCC_VERSION project files, the attribute you need looks like GCC_VERSION , and these are valid values ​​(my Xcode is 4.0.2, gcc v4.2).

 GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_VERSION = 4.2 GCC_VERSION = com.apple.compilers.llvmgcc42 

The documentation of My CMake seems to suggest that you want to set XCODE_ATTRIBUTE_X not CMAKE_XCODE_ATTRIBUTE_X either.

+4
source

Source: https://habr.com/ru/post/901897/


All Articles