Skip to content

Commit 62ef67d

Browse files
committed
offload-tunnel-cmake with proper escape
1 parent f4784b7 commit 62ef67d

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
@@ -507,10 +507,18 @@ if(build_runtimes)
507507
endif()
508508

509509
# Forward user-provived system configuration to runtimes for requirement introspection.
510-
# CMAKE_PREFIX_PATH is the search path for CMake packages.
510+
# CMAKE_PREFIX_PATH is the search path for CMake packages. In order to pass through
511+
# the command line interface, the CMake semicolon separator needs to be replaced
512+
# with $<SEMICOLON>
511513
if(CMAKE_PREFIX_PATH)
512-
list(APPEND extra_cmake_args "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
514+
string(JOIN "$<SEMICOLON>" escaped_cmake_prefix_path ${CMAKE_PREFIX_PATH})
515+
# Some projects require access to the LLVM lib/cmake directory
516+
if (OFFLOAD_EXTERNAL_PROJECT_UNIFIED_ROCR OR DEFINED LIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH)
517+
string(PREPEND escaped_cmake_prefix_path "${CMAKE_BINARY_DIR}/lib/cmake$<SEMICOLON>")
518+
endif()
519+
list(APPEND extra_cmake_args "-DCMAKE_PREFIX_PATH=${escaped_cmake_prefix_path}")
513520
endif()
521+
514522
# CMAKE_PROGRAM_PATH is the search path for executables such as python.
515523
if(CMAKE_PROGRAM_PATH)
516524
list(APPEND extra_cmake_args "-DCMAKE_PROGRAM_PATH=${CMAKE_PROGRAM_PATH}")
@@ -539,9 +547,6 @@ if(build_runtimes)
539547
if("openmp" IN_LIST LLVM_ENABLE_RUNTIMES OR "offload" IN_LIST LLVM_ENABLE_RUNTIMES)
540548
# With ROCm 6.3 the ROCr runtime and the thunk layer share a single repository.
541549
# No need to provide a separate path for ROCt.
542-
if (OFFLOAD_EXTERNAL_PROJECT_UNIFIED_ROCR OR DEFINED LIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH)
543-
list(APPEND extra_cmake_args "-DCMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/lib/cmake$<SEMICOLON>${CMAKE_PREFIX_PATH}")
544-
endif()
545550
if (OFFLOAD_EXTERNAL_PROJECT_UNIFIED_ROCR)
546551
if(NOT DEFINED LIBOMPTARGET_EXTERNAL_PROJECT_HSA_PATH)
547552
message(SEND_ERROR "External ROCr requires setting LIBOMPTARGET_EXTERNAL_PROJECT_HSA_PATH")

0 commit comments

Comments
 (0)