Skip to content

Commit

Permalink
build: fix identification of host compiler version
Browse files Browse the repository at this point in the history
  • Loading branch information
densamoilov committed Jul 19, 2024
1 parent 87848b9 commit 730b976
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmake/host_compiler_id.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ message(STATUS "Host compiler kind: ${DPCPP_HOST_COMPILER_KIND}")
# Preprocessor prints out major and minor versions of the compiler when
# compiling host_compiler_id.cpp. Using the regex below to extract
# the versions from the preprocessor message.
string(REGEX MATCH "([0-9]+\\.[0-9]+)" _ "${STDERR_MESSAGE}")
string(REGEX MATCH "host compiler version: ([0-9]+\\.[0-9]+)" _ "${STDERR_MESSAGE}")
set(DPCPP_HOST_COMPILER_VER ${CMAKE_MATCH_1} CACHE INTERNAL "")

string(REPLACE "." ";" DPCPP_HOST_COMPILER_VER_LIST ${DPCPP_HOST_COMPILER_VER})
Expand Down
6 changes: 4 additions & 2 deletions cmake/host_compiler_id.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ int main() {

#if (defined __GNUC__) && (!defined(__INTEL_COMPILER)) \
&& (!defined(__INTEL_LLVM_COMPILER)) && (!defined(__clang_major__))
#pragma message(STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__))
#pragma message("host compiler version: " STRINGIFY(__GNUC__) "." STRINGIFY( \
__GNUC_MINOR__))
return 0;
#else
breaks_on_purpose
Expand All @@ -31,7 +32,8 @@ int main() {
#elif defined(TRY_CLANG)

#if (!defined(__INTEL_LLVM_COMPILER)) && (defined(__clang_major__))
#pragma message(STRINGIFY(__clang_major__) "." STRINGIFY(__clang_minor__))
#pragma message("host compiler version: " STRINGIFY( \
__clang_major__) "." STRINGIFY(__clang_minor__))
return 0;
#else
breaks_on_purpose
Expand Down

0 comments on commit 730b976

Please sign in to comment.