Skip to content

Commit

Permalink
Fix bug in CMake function (#7604)
Browse files Browse the repository at this point in the history
Ignore missing directory in xrt_add_subdirectory.

xrt_add_subdirectory is used to conditionally exclude directories from
CMake generation.  If the directory was explicitly removed prior to
CMake generation, the function would error.

Add test that directory exists.
  • Loading branch information
stsoe committed Jun 27, 2023
1 parent 6eff2fc commit ff95b8a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/CMake/utilities.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (C) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.

# xrt_add_subdirectory subdir [bindir] [exclude_from_all] [system]
# See CMake: add_subdirectory
Expand All @@ -21,9 +21,11 @@ function(xrt_add_subdirectory subdir)
file(RELATIVE_PATH relpath ${xrtroot} ${path})
if (${relpath} IN_LIST XRT_EXCLUDE_SUB_DIRECTORY)
message("-- xrt_add_subdirectory excludes ${subdir}")
else()
elseif (EXISTS ${path})
message("-- add_subdirectory(${ARGV})")
add_subdirectory(${ARGV})
else ()
message("-- xrt_add_subdirectory ${subdir} does not exist")
endif()
endfunction()

Expand Down

0 comments on commit ff95b8a

Please sign in to comment.