build: Don't set recommended properties if they were already set

This commit is contained in:
WerWolv 2023-07-15 14:29:54 +02:00
parent 5171bea0bf
commit 2fea1975c2
1 changed files with 23 additions and 13 deletions

View File

@ -291,35 +291,45 @@ macro(configureCMake)
find_program(AR_LLVMLIBS_PATH llvm-ar) find_program(AR_LLVMLIBS_PATH llvm-ar)
find_program(RANLIB_LLVMLIBS_PATH llvm-ranlib) find_program(RANLIB_LLVMLIBS_PATH llvm-ranlib)
if (CCACHE_PATH AND NOT CMAKE_C_COMPILER_LAUNCHER AND NOT CMAKE_CXX_COMPILER_LAUNCHER) if (CCACHE_PATH)
if (NOT CMAKE_C_COMPILER_LAUNCHER AND NOT CMAKE_CXX_COMPILER_LAUNCHER)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PATH}) set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PATH})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PATH}) set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PATH})
endif ()
else () else ()
message(WARNING "ccache not found!") message(WARNING "ccache not found!")
endif () endif ()
if (AR_LLVMLIBS_PATH AND NOT CMAKE_AR) if (AR_LLVMLIBS_PATH)
if (NOT CMAKE_AR)
set(CMAKE_AR ${AR_LLVMLIBS_PATH}) set(CMAKE_AR ${AR_LLVMLIBS_PATH})
endif ()
else () else ()
message(WARNING "llvm-ar not found, using default ar!") message(WARNING "llvm-ar not found, using default ar!")
endif () endif ()
if (RANLIB_LLVMLIBS_PATH AND NOT CMAKE_RANLIB) if (RANLIB_LLVMLIBS_PATH)
if (NOT CMAKE_RANLIB)
set(CMAKE_RANLIB ${RANLIB_LLVMLIBS_PATH}) set(CMAKE_RANLIB ${RANLIB_LLVMLIBS_PATH})
endif ()
else () else ()
message(WARNING "llvm-ranlib not found, using default ranlib!") message(WARNING "llvm-ranlib not found, using default ranlib!")
endif () endif ()
if (LD_LLD_PATH AND NOT CMAKE_LINKER) if (LD_LLD_PATH)
if (NOT CMAKE_LINKER)
set(CMAKE_LINKER ${LD_LLD_PATH}) set(CMAKE_LINKER ${LD_LLD_PATH})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=lld") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=lld")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=lld") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=lld")
endif ()
else () else ()
message(WARNING "lld not found, using default linker!") message(WARNING "lld not found, using default linker!")
endif () endif ()
if (NINJA_PATH AND NOT CMAKE_GENERATOR) if (NINJA_PATH)
if (NOT CMAKE_GENERATOR)
set(CMAKE_GENERATOR Ninja) set(CMAKE_GENERATOR Ninja)
endif ()
else () else ()
message(WARNING "ninja not found, using default generator!") message(WARNING "ninja not found, using default generator!")
endif () endif ()