|
|
@@ -113,6 +113,29 @@ if(NOT CMAKE_HIP_COMPILER_ID_RUN)
|
|
|
if(NOT EXISTS "${CMAKE_HIP_HOST_COMPILER}")
|
|
|
message(FATAL_ERROR "Could not find compiler set in environment variable HIPHOSTCXX:\n$ENV{HIPHOSTCXX}.\n${CMAKE_HIP_HOST_COMPILER}")
|
|
|
endif()
|
|
|
+ elseif(CMAKE_HIP_HOST_COMPILER)
|
|
|
+ # We get here if CMAKE_HIP_HOST_COMPILER was specified by the user or toolchain file.
|
|
|
+ if(IS_ABSOLUTE "${CMAKE_HIP_HOST_COMPILER}")
|
|
|
+ # Convert to forward slashes.
|
|
|
+ cmake_path(CONVERT "${CMAKE_HIP_HOST_COMPILER}" TO_CMAKE_PATH_LIST CMAKE_HIP_HOST_COMPILER NORMALIZE)
|
|
|
+ else()
|
|
|
+ # Convert to absolute path so changes in `PATH` do not impact HIP compilation.
|
|
|
+ find_program(_CMAKE_HIP_HOST_COMPILER_PATH NO_CACHE NAMES "${CMAKE_HIP_HOST_COMPILER}")
|
|
|
+ if(_CMAKE_HIP_HOST_COMPILER_PATH)
|
|
|
+ set(CMAKE_HIP_HOST_COMPILER "${_CMAKE_HIP_HOST_COMPILER_PATH}")
|
|
|
+ endif()
|
|
|
+ unset(_CMAKE_HIP_HOST_COMPILER_PATH)
|
|
|
+ endif()
|
|
|
+ if(NOT EXISTS "${CMAKE_HIP_HOST_COMPILER}")
|
|
|
+ message(FATAL_ERROR "Could not find compiler set in variable CMAKE_HIP_HOST_COMPILER:\n ${CMAKE_HIP_HOST_COMPILER}")
|
|
|
+ endif()
|
|
|
+ # If the value was cached, update the cache entry with our modifications.
|
|
|
+ get_property(_CMAKE_HIP_HOST_COMPILER_CACHED CACHE CMAKE_HIP_HOST_COMPILER PROPERTY TYPE)
|
|
|
+ if(_CMAKE_HIP_HOST_COMPILER_CACHED)
|
|
|
+ set_property(CACHE CMAKE_HIP_HOST_COMPILER PROPERTY VALUE "${CMAKE_HIP_HOST_COMPILER}")
|
|
|
+ mark_as_advanced(CMAKE_HIP_HOST_COMPILER)
|
|
|
+ endif()
|
|
|
+ unset(_CMAKE_HIP_HOST_COMPILER_CACHED)
|
|
|
endif()
|
|
|
endif()
|
|
|
|