Skip to content

Commit

Permalink
target from write_git_revision now works with export sets (#474)
Browse files Browse the repository at this point in the history
The git revision target previously wouldn't work when you needed to export targets. Those prohibited projects from producing static targets while also using this function.

Authors:
  - Robert Maynard (https://github.com/robertmaynard)

Approvers:
  - Bradley Dice (https://github.com/bdice)

URL: #474
  • Loading branch information
robertmaynard authored Oct 16, 2023
1 parent e73fef6 commit 5a01aa2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rapids-cmake/cmake/write_git_revision_file.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ function(rapids_cmake_write_git_revision_file target file_path)
add_dependencies(${target} ${target}_compute_git_info)

cmake_path(GET file_path PARENT_PATH file_path_dir)
target_include_directories(${target} INTERFACE ${file_path_dir})
target_include_directories(${target} INTERFACE "$<BUILD_INTERFACE:${file_path_dir}>")

endfunction()
8 changes: 7 additions & 1 deletion testing/cmake/write_git_revision-simple/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2021, NVIDIA CORPORATION.
# Copyright (c) 2021-2023, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,6 +14,7 @@
# limitations under the License.
#=============================================================================
include(${rapids-cmake-dir}/cmake/write_git_revision_file.cmake)
include(${rapids-cmake-dir}/export/export.cmake)

cmake_minimum_required(VERSION 3.23.1)

Expand All @@ -26,3 +27,8 @@ rapids_cmake_write_git_revision_file(nested_version "${CMAKE_CURRENT_BINARY_DIR}
add_executable(write_git_version main.cpp)
target_link_libraries(write_git_version PRIVATE demo_version nested_version)
target_compile_features(write_git_version PRIVATE cxx_std_14)

install(TARGETS write_git_version EXPORT write_git)
rapids_export(BUILD DEMO
EXPORT_SET write_git
)

0 comments on commit 5a01aa2

Please sign in to comment.