diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fa41c0cbc..198f5ad8f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,6 @@ cmake_minimum_required(VERSION 3.21) +include(ExternalProject) +include(FetchContent) if(NOT CMAKE_GENERATOR MATCHES "Makefiles") message(FATAL_ERROR "Only makefile generators are supported") @@ -34,7 +36,6 @@ foreach(var ${vars}) endif() endforeach() -include(ExternalProject) project(LEAN CXX C) if(NOT (DEFINED STAGE0_CMAKE_EXECUTABLE_SUFFIX)) @@ -119,17 +120,16 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten") endif() if(USE_MIMALLOC) - ExternalProject_Add( + FetchContent_Declare( mimalloc - PREFIX mimalloc GIT_REPOSITORY https://github.com/microsoft/mimalloc GIT_TAG v2.2.3 - # just download, we compile it as part of each stage as it is small - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" + # Unnecessarily deep directory structure, but it saves us from a complicated + # stage0 update for now. If we ever update the other dependencies like + # cadical, it might be worth reorganizing the directory structure. + SOURCE_DIR "${CMAKE_BINARY_DIR}/mimalloc/src/mimalloc" ) - list(APPEND EXTRA_DEPENDS mimalloc) + FetchContent_MakeAvailable(mimalloc) endif() if(NOT STAGE1_PREV_STAGE)