fix: preserve absolute compiler paths in CMakeLists.txt and update presets to use absolute paths
This commit is contained in:
@@ -3,10 +3,31 @@
|
||||
##### CMAKE LISTS ##############################################################
|
||||
################################################################################
|
||||
|
||||
# Save compiler and launcher paths if they are absolute (e.g. from presets or CLI)
|
||||
# to prevent conan_toolchain.cmake from overwriting them with relative names.
|
||||
set(_ULIB_SAVE_CC "${CMAKE_C_COMPILER}")
|
||||
set(_ULIB_SAVE_CXX "${CMAKE_CXX_COMPILER}")
|
||||
set(_ULIB_SAVE_CC_LAUNCHER "${CMAKE_C_COMPILER_LAUNCHER}")
|
||||
set(_ULIB_SAVE_CXX_LAUNCHER "${CMAKE_CXX_COMPILER_LAUNCHER}")
|
||||
|
||||
if(EXISTS "${CMAKE_BINARY_DIR}/conan_toolchain.cmake")
|
||||
include("${CMAKE_BINARY_DIR}/conan_toolchain.cmake")
|
||||
endif()
|
||||
|
||||
if(_ULIB_SAVE_CC AND IS_ABSOLUTE "${_ULIB_SAVE_CC}")
|
||||
set(CMAKE_C_COMPILER "${_ULIB_SAVE_CC}" CACHE FILEPATH "C compiler" FORCE)
|
||||
endif()
|
||||
if(_ULIB_SAVE_CXX AND IS_ABSOLUTE "${_ULIB_SAVE_CXX}")
|
||||
set(CMAKE_CXX_COMPILER "${_ULIB_SAVE_CXX}" CACHE FILEPATH "C++ compiler" FORCE)
|
||||
endif()
|
||||
if(_ULIB_SAVE_CC_LAUNCHER AND IS_ABSOLUTE "${_ULIB_SAVE_CC_LAUNCHER}")
|
||||
set(CMAKE_C_COMPILER_LAUNCHER "${_ULIB_SAVE_CC_LAUNCHER}" CACHE FILEPATH "C compiler launcher" FORCE)
|
||||
endif()
|
||||
if(_ULIB_SAVE_CXX_LAUNCHER AND IS_ABSOLUTE "${_ULIB_SAVE_CXX_LAUNCHER}")
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER "${_ULIB_SAVE_CXX_LAUNCHER}" CACHE FILEPATH "C++ compiler launcher" FORCE)
|
||||
endif()
|
||||
|
||||
|
||||
cmake_minimum_required (VERSION 3.26)
|
||||
|
||||
set(QT_NO_VERSION_CHECK TRUE)
|
||||
|
||||
Reference in New Issue
Block a user