From 94794010bf170b0b67036af72d1daac71a02e4da Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Mon, 26 Feb 2024 18:11:35 +0000 Subject: [PATCH] [cmake] Only require git when running benchmarks. This should improve the current infrastructure for releasing clad on conda. The conda recipe downloads the tarball and it currently fails because we rely on being inside a git setup when building. --- cmake/modules/AddClad.cmake | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cmake/modules/AddClad.cmake b/cmake/modules/AddClad.cmake index cee94f983..a765bb243 100644 --- a/cmake/modules/AddClad.cmake +++ b/cmake/modules/AddClad.cmake @@ -1,15 +1,18 @@ -# Find the current branch. -execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND git rev-parse HEAD - OUTPUT_VARIABLE CURRENT_REPO_COMMIT - OUTPUT_STRIP_TRAILING_WHITESPACE) -string(REPLACE "/" "" CURRENT_REPO_COMMIT ${CURRENT_REPO_COMMIT}) +if (CLAD_ENABLE_BENCHMARKS) + # Find the current branch. + execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND git rev-parse HEAD + OUTPUT_VARIABLE CURRENT_REPO_COMMIT + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REPLACE "/" "" CURRENT_REPO_COMMIT ${CURRENT_REPO_COMMIT}) # Ask cmake to reconfigure each time we change the branch so that it can change # the value of CURRENT_REPO_COMMIT. set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/.git/HEAD") +endif(CLAD_ENABLE_BENCHMARKS) + #------------------------------------------------------------------------------- # function ENABLE_CLAD_FOR_EXECUTABLE( # DEPENDS dependencies...