Skip to content

Commit 9046f1e

Browse files
author
Salinas, David
authored
offload-tunnel-cmake with proper escape (llvm#4312)
2 parents 39bfe1b + eb22c5a commit 9046f1e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

llvm/runtimes/CMakeLists.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,18 @@ if(build_runtimes)
502502
endif()
503503

504504
# Forward user-provived system configuration to runtimes for requirement introspection.
505-
# CMAKE_PREFIX_PATH is the search path for CMake packages.
505+
# CMAKE_PREFIX_PATH is the search path for CMake packages. In order to pass through
506+
# the command line interface, the CMake semicolon separator needs to be replaced
507+
# with $<SEMICOLON>
506508
if(CMAKE_PREFIX_PATH)
507-
list(APPEND extra_cmake_args "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
509+
string(JOIN "$<SEMICOLON>" escaped_cmake_prefix_path ${CMAKE_PREFIX_PATH})
510+
# Some projects require access to the LLVM lib/cmake directory
511+
if (OFFLOAD_EXTERNAL_PROJECT_UNIFIED_ROCR OR DEFINED LIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH)
512+
string(PREPEND escaped_cmake_prefix_path "${CMAKE_BINARY_DIR}/lib/cmake$<SEMICOLON>")
513+
endif()
514+
list(APPEND extra_cmake_args "-DCMAKE_PREFIX_PATH=${escaped_cmake_prefix_path}")
508515
endif()
516+
509517
# CMAKE_PROGRAM_PATH is the search path for executables such as python.
510518
if(CMAKE_PROGRAM_PATH)
511519
list(APPEND extra_cmake_args "-DCMAKE_PROGRAM_PATH=${CMAKE_PROGRAM_PATH}")
@@ -522,9 +530,6 @@ if(build_runtimes)
522530
if("openmp" IN_LIST LLVM_ENABLE_RUNTIMES OR "offload" IN_LIST LLVM_ENABLE_RUNTIMES)
523531
# With ROCm 6.3 the ROCr runtime and the thunk layer share a single repository.
524532
# No need to provide a separate path for ROCt.
525-
if (OFFLOAD_EXTERNAL_PROJECT_UNIFIED_ROCR OR DEFINED LIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH)
526-
list(APPEND extra_cmake_args "-DCMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/lib/cmake$<SEMICOLON>${CMAKE_PREFIX_PATH}")
527-
endif()
528533
if (OFFLOAD_EXTERNAL_PROJECT_UNIFIED_ROCR)
529534
if(NOT DEFINED LIBOMPTARGET_EXTERNAL_PROJECT_HSA_PATH)
530535
message(SEND_ERROR "External ROCr requires setting LIBOMPTARGET_EXTERNAL_PROJECT_HSA_PATH")

0 commit comments

Comments
 (0)