# Resolve tools before project() performs its compiler and generator checks. if(CMAKE_GENERATOR MATCHES "Makefiles|Ninja") foreach(language C CXX) if(language STREQUAL "C") set(names clang-23 clang) set(compiler_environment CC) else() set(names clang++-23 clang++) set(compiler_environment CXX) endif() if(CMAKE_${language}_COMPILER) if(NOT IS_ABSOLUTE "${CMAKE_${language}_COMPILER}") cpsc_find_dependency(PROGRAM CMAKE_${language}_COMPILER NAMES "${CMAKE_${language}_COMPILER}" REQUIRED) endif() elseif("$ENV{${compiler_environment}}" STREQUAL "") cpsc_find_dependency(PROGRAM CMAKE_${language}_COMPILER NAMES ${names} REQUIRED) endif() # project() would otherwise restore the previous path from this file. set(compiler_info "${CMAKE_BINARY_DIR}/CMakeFiles/${CMAKE_VERSION}/CMake${language}Compiler.cmake") if(EXISTS "${compiler_info}") file(STRINGS "${compiler_info}" previous REGEX "^set\\(CMAKE_${language}_COMPILER \"") string(REGEX REPLACE "^set\\(CMAKE_${language}_COMPILER \"([^\"]*)\"\\)$" "\\1" previous "${previous}") if(NOT previous STREQUAL CMAKE_${language}_COMPILER) file(REMOVE "${compiler_info}") endif() endif() endforeach() endif() if(CMAKE_GENERATOR MATCHES "Ninja") set(names ninja ninja-build) elseif(CMAKE_GENERATOR STREQUAL "MinGW Makefiles") set(names mingw32-make) elseif(CMAKE_GENERATOR MATCHES "NMake") set(names nmake) elseif(CMAKE_GENERATOR STREQUAL "MSYS Makefiles") set(names make) elseif(CMAKE_GENERATOR STREQUAL "Unix Makefiles") set(names gmake make) else() set(names) endif() if(names) cpsc_find_dependency(PROGRAM CMAKE_MAKE_PROGRAM NAMES ${names} REQUIRED) endif()