I'm not certain about needing CMAKE_SYSTEM_PROCESSOR here or if it is fine to just use CMAKE_C_COMPILER_TARGET/CMAKE_CXX_COMPILER_TARGET for this? If there isn't a complaint from CMake about Swift not supporting
Additional context I add following code in in cmake/compiler/gcc/target_riscv.cmake, it works. set(riscv_march "rv32imafcpzpsfoperand_xtheade") set(riscv_mabi "ilp32f") list(APPEND TOOLCHAIN_C_FLAGS -mabi=${riscv_mabi} -march=${riscv_march}) list(APPEND TOOLCHAIN_LD_FLAGS NO_S...
注意:必须先include(CheckCXXCompilerFlag) 例子1:在检查当前编译器是否支持c++11 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) CHECK_CXX_COMPILER_FLAG("-std=c++0x"COMPILER_SUPPORTS_CXX0X) if(COMPILER_SUPPORTS_CXX11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s...
However in practice in one test I did, it worked just fine to set it up on the command line with e.g.-DCMAKE_CXX_COMPILER_TARGETtoo, e.g. for cross compiling with Clang like-DCMAKE_SYSTEM_NAME=Windows -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_COMPILER_TARGET=x86_64-w64-mingw32...