From a084db68172ffa4028c1199203f2e588338ff052 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 5 Oct 2023 18:52:05 +0300 Subject: [PATCH] BuildSystem: Try to set compiler only if it exists --- CMakeLists.txt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5da27514cc..4c3056da44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,16 +8,14 @@ endif() set(TOOLCHAIN_PREFIX ${CMAKE_SOURCE_DIR}/toolchain/local) -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED True) -set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}/bin/${BANAN_ARCH}-banan_os-g++) -set(CMAKE_CXX_COMPILER_WORKS True) +if(EXISTS ${TOOLCHAIN_PREFIX}/bin/${BANAN_ARCH}-banan_os-g++) + set(CMAKE_CXX_STANDARD 20) + set(CMAKE_CXX_STANDARD_REQUIRED True) + set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}/bin/${BANAN_ARCH}-banan_os-g++) + set(CMAKE_CXX_COMPILER_WORKS True) -set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}/bin/${BANAN_ARCH}-banan_os-gcc) -set(CMAKE_C_COMPILER_WORKS True) - -if(NOT EXISTS ${CMAKE_CXX_COMPILER}) - set(CMAKE_CXX_COMPILER g++) + set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}/bin/${BANAN_ARCH}-banan_os-gcc) + set(CMAKE_C_COMPILER_WORKS True) endif() if(DEFINED QEMU_ACCEL)