From 39ba9175c61d9b7f7bcff38099e5eca89e84aeb1 Mon Sep 17 00:00:00 2001 From: Tim Martin <38798827+tmartin-gh@users.noreply.github.com> Date: Wed, 15 Jan 2025 19:34:04 -0800 Subject: [PATCH] Cleanup cmake usage when MatX is a dependent project (#827) --- CMakeLists.txt | 6 ++++-- test/CMakeLists.txt | 12 ++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 83e074706..62efeb8aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,8 +16,10 @@ endif() if(NOT DEFINED rapids-cmake-dir) include(FetchContent) # Tell FetchContent to just use the local copy of rapids-cmake: - set(FETCHCONTENT_SOURCE_DIR_RAPIDS_CMAKE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/rapids-cmake") - FetchContent_Declare(rapids-cmake URL https://github.com/rapidsai/rapids-cmake/archive/refs/heads/branch-24.12.zip) + FetchContent_Declare(rapids-cmake SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/rapids-cmake") + + # Tell FetchContent to download remote copy of rapids-cmake: + #FetchContent_Declare(rapids-cmake URL https://github.com/rapidsai/rapids-cmake/archive/refs/heads/branch-24.12.zip) FetchContent_MakeAvailable(rapids-cmake) else() # The include() commands below search the module path for the corresponding .cmake files diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index bade207af..c6e619caa 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -41,7 +41,7 @@ set (test_sources ) # Some of <00_io> tests need csv files and binaries which all -# are located under 'CMAKE_SOURCE_DIR/test/00_io'. When calling the test +# are located under 'CMAKE_CURRENT_SOURCE_DIR/00_io'. When calling the test # executable from its location in 'CMAKE_BINARY_DIR/test' the # search paths according are # '../test/00_io/small_csv_comma_nh.csv' and @@ -49,19 +49,19 @@ set (test_sources # they must be copied to the correct location: file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/test/00_io) file(COPY - ${CMAKE_SOURCE_DIR}/test/00_io/small_csv_comma_nh.csv + ${CMAKE_CURRENT_SOURCE_DIR}/00_io/small_csv_comma_nh.csv DESTINATION ${CMAKE_BINARY_DIR}/test/00_io ) file(COPY - ${CMAKE_SOURCE_DIR}/test/00_io/small_csv_complex_comma_nh.csv + ${CMAKE_CURRENT_SOURCE_DIR}/00_io/small_csv_complex_comma_nh.csv DESTINATION ${CMAKE_BINARY_DIR}/test/00_io ) file(COPY - ${CMAKE_SOURCE_DIR}/test/00_io/test.mat + ${CMAKE_CURRENT_SOURCE_DIR}/00_io/test.mat DESTINATION ${CMAKE_BINARY_DIR}/test/00_io ) file(COPY - ${CMAKE_SOURCE_DIR}/test/00_io/test.npy + ${CMAKE_CURRENT_SOURCE_DIR}/00_io/test.npy DESTINATION ${CMAKE_BINARY_DIR}/test/00_io ) @@ -72,7 +72,7 @@ foreach (ptest ${proprietary_sources}) list(APPEND proprietary_inc_list ${incdir}/../examples) endforeach() -set(target_inc ${CMAKE_SOURCE_DIR}/test/include ${CMAKE_SOURCE_DIR}/examples/ ${proprietary_inc_list}) +set(target_inc ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/../examples/ ${proprietary_inc_list}) set(system_inc ${CUTLASS_INC} ${GTEST_INC_DIRS} ${pybind11_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS}) set(all_test_srcs ${test_sources} ${proprietary_sources})