Xcode: Generate project fails compiler identification with gcc toolchain
This is my toolchain
set(CMAKE_C_COMPILER gcc-12)
set(CMAKE_CXX_COMPILER g++-12)
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html#variable:CMAKE_%3CLANG%3E_COMPILER_ID
set(CMAKE_C_COMPILER_ID "GNU")
set(CMAKE_CXX_COMPILER_ID "GNU")
which I'm trying to use like this
cmake -B build -T g++-12.cmake -GXcode
but it fails
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:4 (project):
No CMAKE_C_COMPILER could be found.
even though CMakeDetermineCompilerId.cmake should pass from visual inspection of the code here
# Display the final identification result.
if(CMAKE_${lang}_COMPILER_ID)
if(CMAKE_${lang}_COMPILER_VERSION)
set(_version " ${CMAKE_${lang}_COMPILER_VERSION}")
else()
set(_version "")
endif()
if(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID AND "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xIAR")
set(_archid " ${CMAKE_${lang}_COMPILER_ARCHITECTURE_ID}")
else()
set(_archid "")
endif()
message(STATUS "The ${lang} compiler identification is "
"${CMAKE_${lang}_COMPILER_ID}${_archid}${_version}${_variant}")
unset(_archid)
unset(_version)
unset(_variant)
else()
message(STATUS "The ${lang} compiler identification is unknown")
endif()
Does it have to do with my toolchain or am I asking for trouble trying to generate Xcode with GCC toolchain? I guess I'm not even at project generator stage since identification fails?