diff --git a/cmake/NVBenchRapidsCMake.cmake b/cmake/NVBenchRapidsCMake.cmake index 5610cb0..b110ccc 100644 --- a/cmake/NVBenchRapidsCMake.cmake +++ b/cmake/NVBenchRapidsCMake.cmake @@ -21,9 +21,5 @@ endmacro() macro(nvbench_init_rapids_cmake) rapids_cmake_build_type(Release) rapids_cmake_write_version_file("${NVBench_BINARY_DIR}/nvbench/detail/version.cuh") - rapids_cmake_write_git_revision_file( - nvbench_git_revision - "${NVBench_BINARY_DIR}/nvbench/detail/git_revision.cuh" - ) rapids_cpm_init() endmacro() diff --git a/nvbench/CMakeLists.txt b/nvbench/CMakeLists.txt index df12a7c..b9983d8 100644 --- a/nvbench/CMakeLists.txt +++ b/nvbench/CMakeLists.txt @@ -132,12 +132,20 @@ endif() # Use `nvbench_git_revision` but don't expose it as part of our export information # In CMake 3.27 this is easily done with $, before that we have to # manual copy the include path +# +# The call to `rapids_cmake_write_git_revision_file` must be in the same +# CMakeLists.txt as the consumer ( nvbench ) for CMake to get the dependency +# graph correct. +rapids_cmake_write_git_revision_file( + nvbench_git_revision + "${NVBench_BINARY_DIR}/nvbench/detail/git_revision.cuh" +) if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.27) target_link_libraries(nvbench PRIVATE $) else() # Need to add dependencies on the internal implementation targets from rapids-cmake # so that we generate the git header before using it - add_dependencies(nvbench nvbench_git_revision nvbench_git_revision_compute_git_info) + add_dependencies(nvbench nvbench_git_revision_compute_git_info) get_target_property(_include_dir nvbench_git_revision INTERFACE_INCLUDE_DIRECTORIES) target_include_directories(nvbench PRIVATE "$") endif()