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)
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_C_COMPILER": "clang",
|
||||
"CMAKE_CXX_COMPILER": "clang++",
|
||||
"CMAKE_C_COMPILER": "/home/share/micromamba/envs/uLib/bin/clang",
|
||||
"CMAKE_CXX_COMPILER": "/home/share/micromamba/envs/uLib/bin/clang++",
|
||||
"CMAKE_EXE_LINKER_FLAGS": "-fuse-ld=lld",
|
||||
"CMAKE_SHARED_LINKER_FLAGS": "-fuse-ld=lld",
|
||||
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
|
||||
"CMAKE_C_COMPILER_LAUNCHER": "ccache"
|
||||
"CMAKE_CXX_COMPILER_LAUNCHER": "/home/share/micromamba/envs/uLib/bin/ccache",
|
||||
"CMAKE_C_COMPILER_LAUNCHER": "/home/share/micromamba/envs/uLib/bin/ccache"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -36,12 +36,12 @@
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_C_COMPILER": "clang",
|
||||
"CMAKE_CXX_COMPILER": "clang++",
|
||||
"CMAKE_C_COMPILER": "/home/share/micromamba/envs/uLib/bin/clang",
|
||||
"CMAKE_CXX_COMPILER": "/home/share/micromamba/envs/uLib/bin/clang++",
|
||||
"CMAKE_EXE_LINKER_FLAGS": "-fuse-ld=lld",
|
||||
"CMAKE_SHARED_LINKER_FLAGS": "-fuse-ld=lld",
|
||||
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
|
||||
"CMAKE_C_COMPILER_LAUNCHER": "ccache"
|
||||
"CMAKE_CXX_COMPILER_LAUNCHER": "/home/share/micromamba/envs/uLib/bin/ccache",
|
||||
"CMAKE_C_COMPILER_LAUNCHER": "/home/share/micromamba/envs/uLib/bin/ccache"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -52,12 +52,12 @@
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_C_COMPILER": "clang",
|
||||
"CMAKE_CXX_COMPILER": "clang++",
|
||||
"CMAKE_C_COMPILER": "/home/share/micromamba/envs/uLib/bin/clang",
|
||||
"CMAKE_CXX_COMPILER": "/home/share/micromamba/envs/uLib/bin/clang++",
|
||||
"CMAKE_EXE_LINKER_FLAGS": "-fuse-ld=lld",
|
||||
"CMAKE_SHARED_LINKER_FLAGS": "-fuse-ld=lld",
|
||||
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
|
||||
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
|
||||
"CMAKE_CXX_COMPILER_LAUNCHER": "/home/share/micromamba/envs/uLib/bin/ccache",
|
||||
"CMAKE_C_COMPILER_LAUNCHER": "/home/share/micromamba/envs/uLib/bin/ccache",
|
||||
"USE_CUDA": "ON"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user