@@ -412,13 +412,24 @@ if(UMF_BUILD_LEVEL_ZERO_PROVIDER)
412
412
413
413
message (STATUS "Fetching Level Zero loader (${LEVEL_ZERO_LOADER_TAG} ) "
414
414
"from ${LEVEL_ZERO_LOADER_REPO} ..." )
415
- FetchContent_Declare(
416
- level-zero-loader
417
- GIT_REPOSITORY ${LEVEL_ZERO_LOADER_REPO}
418
- GIT_TAG ${LEVEL_ZERO_LOADER_TAG}
419
- EXCLUDE_FROM_ALL )
420
- # Only populate the repo - we don't need to build it
421
- FetchContent_Populate(level-zero-loader)
415
+
416
+ # We don't want to build and include Level Zero binaries to our install
417
+ # target. For CMake >= 3.28 we could use EXCLUDE_FROM_ALL flag to do
418
+ # that, but for older versions we need to use FetchContent_Populate
419
+ if (CMAKE_VERSION VERSION_LESS 3.28)
420
+ FetchContent_Declare(
421
+ level-zero-loader
422
+ GIT_REPOSITORY ${LEVEL_ZERO_LOADER_REPO}
423
+ GIT_TAG ${LEVEL_ZERO_LOADER_TAG} )
424
+ FetchContent_Populate(level-zero-loader)
425
+ else ()
426
+ FetchContent_Declare(
427
+ level-zero-loader
428
+ GIT_REPOSITORY ${LEVEL_ZERO_LOADER_REPO}
429
+ GIT_TAG ${LEVEL_ZERO_LOADER_TAG}
430
+ EXCLUDE_FROM_ALL )
431
+ FetchContent_MakeAvailable(level-zero-loader)
432
+ endif ()
422
433
423
434
set (LEVEL_ZERO_INCLUDE_DIRS
424
435
${level-zero-loader_SOURCE_DIR}/include
@@ -457,13 +468,24 @@ if(UMF_BUILD_CUDA_PROVIDER)
457
468
458
469
message (
459
470
STATUS "Fetching CUDA (${CUDA_TAG} ) headers from ${CUDA_REPO} ..." )
460
- FetchContent_Declare(
461
- cuda-headers
462
- GIT_REPOSITORY ${CUDA_REPO}
463
- GIT_TAG ${CUDA_TAG}
464
- EXCLUDE_FROM_ALL )
465
- # Only populate the repo - we don't need to build it
466
- FetchContent_Populate(cuda-headers)
471
+
472
+ # We don't want to build and include Level Zero binaries to our install
473
+ # target. For CMake >= 3.28 we could use EXCLUDE_FROM_ALL flag to do
474
+ # that, but for older versions we need to use FetchContent_Populate
475
+ if (CMAKE_VERSION VERSION_LESS 3.28)
476
+ FetchContent_Declare(
477
+ cuda-headers
478
+ GIT_REPOSITORY ${CUDA_REPO}
479
+ GIT_TAG ${CUDA_TAG} )
480
+ FetchContent_Populate(cuda-headers)
481
+ else ()
482
+ FetchContent_Declare(
483
+ cuda-headers
484
+ GIT_REPOSITORY ${CUDA_REPO}
485
+ GIT_TAG ${CUDA_TAG}
486
+ EXCLUDE_FROM_ALL )
487
+ FetchContent_MakeAvailable(cuda-headers)
488
+ endif ()
467
489
468
490
set (CUDA_INCLUDE_DIRS
469
491
${cuda-headers_SOURCE_DIR}
0 commit comments