diff --git a/CMakeLists.txt b/CMakeLists.txt index 1cd5892db..50d12cdfc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -232,6 +232,14 @@ if(MPI_FOUND) endif() endif() +message(STATUS "Downloading json") +FetchContent_Declare( + json + URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz) +FetchContent_MakeAvailable(json) +target_include_directories( + mlx PRIVATE $) + add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/mlx) target_include_directories( diff --git a/mlx/io/CMakeLists.txt b/mlx/io/CMakeLists.txt index 2402ff588..f9ab1c44e 100644 --- a/mlx/io/CMakeLists.txt +++ b/mlx/io/CMakeLists.txt @@ -1,13 +1,6 @@ target_sources(mlx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/load.cpp) if(MLX_BUILD_SAFETENSORS) - message(STATUS "Downloading json") - FetchContent_Declare( - json - URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz) - FetchContent_MakeAvailable(json) - target_include_directories( - mlx PRIVATE $) target_sources(mlx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/safetensors.cpp) else() target_sources(mlx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/no_safetensors.cpp)