From b58091fca05bc045eeb76324a7ae943743ae7ef7 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 26 Apr 2024 13:00:09 +0200 Subject: [PATCH] build: make the c-api CMakeLists.txt easier to import Currently the CMakeLists.txt is designed to only be consumed by a parent project, which limits its flexibility. Adding a `project()` function allows it to also be built as its own project. Also set `USES_TERMINAL_BUILD` to `TRUE` in `ExternalProject_Add()`, which allows getting the installation progress output from `cargo build`. --- crates/c-api/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/c-api/CMakeLists.txt b/crates/c-api/CMakeLists.txt index 2075dd2bd696..432df81851fe 100644 --- a/crates/c-api/CMakeLists.txt +++ b/crates/c-api/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.10) +project(wasmtime C) set(WASMTIME_USER_CARGO_BUILD_OPTIONS "" CACHE STRING "Additional cargo flags (such as --features) to apply to the build command") option(BUILD_SHARED_LIBS "Build using shared libraries" OFF) @@ -83,6 +84,7 @@ ExternalProject_Add( CONFIGURE_COMMAND "" INSTALL_COMMAND "${WASMTIME_INSTALL_COMMAND}" BUILD_COMMAND ${WASMTIME_PREBUILD_COMMAND} ${WASMTIME_CARGO_BINARY} build ${WASMTIME_BUILD_TYPE_FLAG} ${WASMTIME_USER_CARGO_BUILD_OPTIONS} ${WASMTIME_BUILD_TARGET} + USES_TERMINAL_BUILD TRUE BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/artifact BUILD_ALWAYS ${WASMTIME_ALWAYS_BUILD} BUILD_BYPRODUCTS ${WASMTIME_BUILD_PRODUCT})