From 3df39a6eedb82ced001ec30926dba3297a540ca3 Mon Sep 17 00:00:00 2001 From: Lukasz Dorau Date: Wed, 28 May 2025 14:37:35 +0200 Subject: [PATCH 1/2] Set *_FOUND in Find*.cmake files Signed-off-by: Lukasz Dorau --- cmake/FindCUDA.cmake | 1 + cmake/FindJEMALLOC.cmake | 1 + cmake/FindLIBHWLOC.cmake | 1 + cmake/FindLIBNUMA.cmake | 1 + cmake/FindTBB.cmake | 1 + cmake/FindZE_LOADER.cmake | 1 + examples/cmake/FindCUDA.cmake | 3 ++- examples/cmake/FindJEMALLOC.cmake | 3 ++- examples/cmake/FindLIBHWLOC.cmake | 3 ++- examples/cmake/FindLIBNUMA.cmake | 3 ++- examples/cmake/FindLIBUMF.cmake | 3 ++- examples/cmake/FindTBB.cmake | 3 ++- examples/cmake/FindZE_LOADER.cmake | 1 + 13 files changed, 19 insertions(+), 6 deletions(-) diff --git a/cmake/FindCUDA.cmake b/cmake/FindCUDA.cmake index 9a9dbec9d2..cfc59b5ad3 100644 --- a/cmake/FindCUDA.cmake +++ b/cmake/FindCUDA.cmake @@ -21,6 +21,7 @@ if(WINDOWS) endif() if(CUDA_LIBRARY) + set(CUDA_FOUND TRUE) message(STATUS " Found cuda using find_library()") message(STATUS " CUDA_LIBRARIES = ${CUDA_LIBRARIES}") message(STATUS " CUDA_INCLUDE_DIRS = ${CUDA_INCLUDE_DIRS}") diff --git a/cmake/FindJEMALLOC.cmake b/cmake/FindJEMALLOC.cmake index 9ee4812a27..524191dcac 100644 --- a/cmake/FindJEMALLOC.cmake +++ b/cmake/FindJEMALLOC.cmake @@ -34,6 +34,7 @@ if(WINDOWS) endif() if(JEMALLOC_LIBRARY) + set(JEMALLOC_FOUND TRUE) message(STATUS " Found jemalloc using find_library()") else() set(MSG_NOT_FOUND diff --git a/cmake/FindLIBHWLOC.cmake b/cmake/FindLIBHWLOC.cmake index 630148476d..f9d1dfe389 100644 --- a/cmake/FindLIBHWLOC.cmake +++ b/cmake/FindLIBHWLOC.cmake @@ -55,6 +55,7 @@ if(WINDOWS) endif() if(LIBHWLOC_LIBRARY) + set(LIBHWLOC_FOUND TRUE) message(STATUS " Found libhwloc: ${LIBHWLOC_LIBRARY}") if(LIBHWLOC_FIND_VERSION) diff --git a/cmake/FindLIBNUMA.cmake b/cmake/FindLIBNUMA.cmake index 47c0658f0b..e0445cfa44 100644 --- a/cmake/FindLIBNUMA.cmake +++ b/cmake/FindLIBNUMA.cmake @@ -8,6 +8,7 @@ find_library(LIBNUMA_LIBRARY NAMES libnuma numa) set(LIBNUMA_LIBRARIES ${LIBNUMA_LIBRARY}) if(LIBNUMA_LIBRARY) + set(LIBNUMA_FOUND TRUE) message(STATUS " Found libnuma using find_library()") else() set(MSG_NOT_FOUND diff --git a/cmake/FindTBB.cmake b/cmake/FindTBB.cmake index 3393011c9e..c1a098a79c 100644 --- a/cmake/FindTBB.cmake +++ b/cmake/FindTBB.cmake @@ -32,6 +32,7 @@ if(WINDOWS) endif() if(TBB_LIBRARY) + set(TBB_FOUND TRUE) message(STATUS " Found tbb using find_library()") message(STATUS " TBB_LIBRARIES = ${TBB_LIBRARIES}") message(STATUS " TBB_INCLUDE_DIRS = ${TBB_INCLUDE_DIRS}") diff --git a/cmake/FindZE_LOADER.cmake b/cmake/FindZE_LOADER.cmake index 81347cb7bf..d87e546c24 100644 --- a/cmake/FindZE_LOADER.cmake +++ b/cmake/FindZE_LOADER.cmake @@ -21,6 +21,7 @@ if(WINDOWS) endif() if(ZE_LOADER_LIBRARY) + set(ZE_LOADER_FOUND TRUE) message(STATUS " Found ZE_LOADER using find_library()") message(STATUS " ZE_LOADER_LIBRARIES = ${ZE_LOADER_LIBRARIES}") message(STATUS " ZE_LOADER_INCLUDE_DIRS = ${ZE_LOADER_INCLUDE_DIRS}") diff --git a/examples/cmake/FindCUDA.cmake b/examples/cmake/FindCUDA.cmake index 5e4e2eeada..d41ddaf77e 100644 --- a/examples/cmake/FindCUDA.cmake +++ b/examples/cmake/FindCUDA.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Intel Corporation +# Copyright (C) 2024-2025 Intel Corporation # Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -17,6 +17,7 @@ if(WINDOWS) endif() if(CUDA_LIBRARY) + set(CUDA_FOUND TRUE) message(STATUS " Found cuda using find_library()") message(STATUS " CUDA_LIBRARIES = ${CUDA_LIBRARIES}") message(STATUS " CUDA_INCLUDE_DIRS = ${CUDA_INCLUDE_DIRS}") diff --git a/examples/cmake/FindJEMALLOC.cmake b/examples/cmake/FindJEMALLOC.cmake index e6db190d4a..6cd1ffedea 100644 --- a/examples/cmake/FindJEMALLOC.cmake +++ b/examples/cmake/FindJEMALLOC.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Intel Corporation +# Copyright (C) 2024-2025 Intel Corporation # Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -36,6 +36,7 @@ if(WINDOWS) endif() if(JEMALLOC_LIBRARY) + set(JEMALLOC_FOUND TRUE) message(STATUS " Found jemalloc using find_library()") message(STATUS " JEMALLOC_LIBRARIES = ${JEMALLOC_LIBRARIES}") message(STATUS " JEMALLOC_INCLUDE_DIRS = ${JEMALLOC_INCLUDE_DIRS}") diff --git a/examples/cmake/FindLIBHWLOC.cmake b/examples/cmake/FindLIBHWLOC.cmake index aa7620bc2d..0bef8be3e2 100644 --- a/examples/cmake/FindLIBHWLOC.cmake +++ b/examples/cmake/FindLIBHWLOC.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Intel Corporation +# Copyright (C) 2024-2025 Intel Corporation # Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -45,6 +45,7 @@ if(WINDOWS) endif() if(LIBHWLOC_LIBRARY) + set(LIBHWLOC_FOUND TRUE) message(STATUS " Found libhwloc using find_library()") message(STATUS " LIBHWLOC_LIBRARIES = ${LIBHWLOC_LIBRARIES}") message(STATUS " LIBHWLOC_INCLUDE_DIRS = ${LIBHWLOC_INCLUDE_DIRS}") diff --git a/examples/cmake/FindLIBNUMA.cmake b/examples/cmake/FindLIBNUMA.cmake index 8c23f481c7..4cf40b60d9 100644 --- a/examples/cmake/FindLIBNUMA.cmake +++ b/examples/cmake/FindLIBNUMA.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Intel Corporation +# Copyright (C) 2024-2025 Intel Corporation # Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -8,6 +8,7 @@ find_library(LIBNUMA_LIBRARY NAMES libnuma numa) set(LIBNUMA_LIBRARIES ${LIBNUMA_LIBRARY}) if(LIBNUMA_LIBRARY) + set(LIBNUMA_FOUND TRUE) message(STATUS " Found libnuma using find_library()") else() set(MSG_NOT_FOUND diff --git a/examples/cmake/FindLIBUMF.cmake b/examples/cmake/FindLIBUMF.cmake index 12bdc18239..6012c07b93 100644 --- a/examples/cmake/FindLIBUMF.cmake +++ b/examples/cmake/FindLIBUMF.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Intel Corporation +# Copyright (C) 2024-2025 Intel Corporation # Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -15,6 +15,7 @@ get_filename_component(LIBUMF_INCLUDE_DIR ${LIBUMF_HEADER} DIRECTORY) set(LIBUMF_INCLUDE_DIRS ${LIBUMF_INCLUDE_DIR}) if(LIBUMF_LIBRARY) + set(LIBUMF_FOUND TRUE) message(STATUS " Found libumf using find_library()") message(STATUS " LIBUMF_LIBRARIES = ${LIBUMF_LIBRARIES}") message(STATUS " LIBUMF_INCLUDE_DIRS = ${LIBUMF_INCLUDE_DIRS}") diff --git a/examples/cmake/FindTBB.cmake b/examples/cmake/FindTBB.cmake index 6536e8c4ae..fea1b7a8cf 100644 --- a/examples/cmake/FindTBB.cmake +++ b/examples/cmake/FindTBB.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2024 Intel Corporation +# Copyright (C) 2024-2025 Intel Corporation # Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -32,6 +32,7 @@ if(WINDOWS) endif() if(TBB_LIBRARY) + set(TBB_FOUND TRUE) message(STATUS " Found tbb using find_library()") message(STATUS " TBB_LIBRARIES = ${TBB_LIBRARIES}") message(STATUS " TBB_INCLUDE_DIRS = ${TBB_INCLUDE_DIRS}") diff --git a/examples/cmake/FindZE_LOADER.cmake b/examples/cmake/FindZE_LOADER.cmake index 6c071491d9..566345de0f 100644 --- a/examples/cmake/FindZE_LOADER.cmake +++ b/examples/cmake/FindZE_LOADER.cmake @@ -21,6 +21,7 @@ if(WINDOWS) endif() if(ZE_LOADER_LIBRARY) + set(ZE_LOADER_FOUND TRUE) message(STATUS " Found ZE_LOADER using find_library()") message(STATUS " ZE_LOADER_LIBRARIES = ${ZE_LOADER_LIBRARIES}") message(STATUS " ZE_LOADER_INCLUDE_DIRS = ${ZE_LOADER_INCLUDE_DIRS}") From c41717760233c49d89a8631894fd2d589518b7fb Mon Sep 17 00:00:00 2001 From: Lukasz Dorau Date: Thu, 29 May 2025 10:03:57 +0200 Subject: [PATCH 2/2] Use *_FOUND in CMake files Fixes: #1192 Signed-off-by: Lukasz Dorau --- CMakeLists.txt | 16 ++++++++-------- test/CMakeLists.txt | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47639d2224..4eeb575df5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -235,12 +235,13 @@ else() jemalloc INTERFACE ${jemalloc_targ_BINARY_DIR}/lib/libjemalloc.a) add_dependencies(jemalloc jemalloc_prod) + set(JEMALLOC_FOUND TRUE) set(JEMALLOC_LIBRARY_DIRS ${jemalloc_targ_BINARY_DIR}/lib) set(JEMALLOC_INCLUDE_DIRS ${jemalloc_targ_BINARY_DIR}/include) set(JEMALLOC_LIBRARIES ${jemalloc_targ_BINARY_DIR}/lib/libjemalloc.a) endif() -if(JEMALLOC_FOUND OR JEMALLOC_LIBRARIES) +if(JEMALLOC_FOUND) set(UMF_POOL_JEMALLOC_ENABLED TRUE) # add PATH to DLL on Windows set(DLL_PATH_LIST @@ -263,12 +264,9 @@ if(NOT UMF_DISABLE_HWLOC AND (NOT UMF_LINK_HWLOC_STATICALLY)) pkg_check_modules(LIBHWLOC hwloc>=2.3.0) if(NOT LIBHWLOC_FOUND) find_package(LIBHWLOC 2.3.0 COMPONENTS hwloc) - if(LIBHWLOC_LIBRARIES) - set(LIBHWLOC_AVAILABLE TRUE) - endif() endif() - if(LIBHWLOC_AVAILABLE OR LIBHWLOC_FOUND) + if(LIBHWLOC_FOUND) # add PATH to DLL on Windows set(DLL_PATH_LIST "${DLL_PATH_LIST};PATH=path_list_append:${LIBHWLOC_DLL_DIRS}") @@ -327,6 +325,7 @@ else() DIRECTORY) set(LIBHWLOC_LIBRARIES ${HWLOC_LIB_PATH}) set(LIBHWLOC_INCLUDE_DIRS ${hwloc_targ_BINARY_DIR}/include) + set(LIBHWLOC_FOUND TRUE) else() # not Windows FetchContent_Declare( hwloc_targ @@ -369,6 +368,7 @@ else() set(LIBHWLOC_LIBRARY_DIRS ${hwloc_targ_BINARY_DIR}/lib) set(LIBHWLOC_INCLUDE_DIRS ${hwloc_targ_BINARY_DIR}/include) set(LIBHWLOC_LIBRARIES ${hwloc_targ_BINARY_DIR}/lib/libhwloc.a) + set(LIBHWLOC_FOUND TRUE) endif() endif() # UMF_LINK_HWLOC_STATICALLY @@ -444,7 +444,7 @@ if(UMF_BUILD_LEVEL_ZERO_PROVIDER) endif() message(STATUS "LEVEL_ZERO_INCLUDE_DIRS = ${LEVEL_ZERO_INCLUDE_DIRS}") - if(ZE_LOADER_LIBRARIES) + if(ZE_LOADER_FOUND) set(UMF_LEVEL_ZERO_ENABLED TRUE) else() message( @@ -500,7 +500,7 @@ if(UMF_BUILD_CUDA_PROVIDER) endif() message(STATUS "CUDA_INCLUDE_DIRS = ${CUDA_INCLUDE_DIRS}") - if(CUDA_LIBRARIES) + if(CUDA_FOUND) set(UMF_CUDA_ENABLED TRUE) else() message( @@ -722,7 +722,7 @@ pkg_check_modules(TBB tbb) if(NOT TBB_FOUND) find_package(TBB OPTIONAL_COMPONENTS tbb) endif() -if(TBB_FOUND OR TBB_LIBRARY_DIRS) +if(TBB_FOUND) # add PATH to DLL on Windows set(DLL_PATH_LIST "${DLL_PATH_LIST};PATH=path_list_append:${TBB_DLL_DIRS}") set(UMF_POOL_SCALABLE_ENABLED TRUE) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 41c5b8dc37..8a25859264 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -674,7 +674,7 @@ if(LINUX ) endif() - if(LIBNUMA_LIBRARIES) + if(LIBNUMA_FOUND) set(EXAMPLES ${EXAMPLES} memspace_hmat memspace_numa) else() message(