From 121a8c0270d5bf980ec288e27b0f049cb187dcf2 Mon Sep 17 00:00:00 2001 From: Lauren Wrubleski Date: Wed, 6 Mar 2024 14:19:59 -0700 Subject: [PATCH] Revent googlebenchmark compiler changes (#458) --- cmake/Dependencies.cmake | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index bcaf3a99..b2c8ab61 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -97,15 +97,21 @@ if(BUILD_BENCHMARK) message(FATAL_ERROR "DownloadProject.cmake doesn't support multi-configuration generators.") endif() set(GOOGLEBENCHMARK_ROOT ${CMAKE_CURRENT_BINARY_DIR}/deps/googlebenchmark CACHE PATH "") - if(DEFINED CMAKE_CXX_COMPILER) - set(CXX_COMPILER_OPTION "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}") + if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")) + # hip-clang cannot compile googlebenchmark for some reason + if(WIN32) + set(COMPILER_OVERRIDE "-DCMAKE_CXX_COMPILER=cl") + else() + set(COMPILER_OVERRIDE "-DCMAKE_CXX_COMPILER=g++") + endif() endif() + download_project( PROJ googlebenchmark GIT_REPOSITORY https://github.com/google/benchmark.git GIT_TAG v1.6.1 INSTALL_DIR ${GOOGLEBENCHMARK_ROOT} - CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=OFF -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_INSTALL_PREFIX= -DCMAKE_CXX_STANDARD=14 ${CXX_COMPILER_OPTION} + CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=OFF -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_INSTALL_PREFIX= -DCMAKE_CXX_STANDARD=14 ${COMPILER_OVERRIDE} LOG_DOWNLOAD TRUE LOG_CONFIGURE TRUE LOG_BUILD TRUE