Skip to content

Commit

Permalink
Put saveguard to avoid defining target more than once
Browse files Browse the repository at this point in the history
These safeguards are needed when the CMakeLists.txt contains:

enable_language(HIP)
find_package(hipblas)

In that case add_library is called twice.
  • Loading branch information
Mathieu Taillefumier committed Jan 24, 2025
1 parent 9d8d35a commit 803177f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hipamd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ configure_package_config_file(
)

configure_package_config_file(
hip-config-nvidia.cmake
hip-config-nvidia.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/hip-config-nvidia.cmake
INSTALL_DESTINATION ${CONFIG_PACKAGE_INSTALL_DIR}
PATH_VARS LIB_INSTALL_DIR INCLUDE_INSTALL_DIR BIN_INSTALL_DIR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

add_library(hip::device INTERFACE IMPORTED)
add_library(hip::host INTERFACE IMPORTED)
add_library(hip::amdhip64 INTERFACE IMPORTED)
foreach(__lib device host amdhip64)
if (NOT TARGET hip::${__lib})
add_library(hip::${__lib} INTERFACE IMPORTED)
set_target_properties(hip::${__lib} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES @PACKAGE_INCLUDE_INSTALL_DIR@
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES @PACKAGE_INCLUDE_INSTALL_DIR@)
endif()
endforeach()

0 comments on commit 803177f

Please sign in to comment.