Calling external build system

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Calling external build system

Niklas Claesson
Hello,

I'm creating a static library (*.a) with a separate build system (cargo). That build system also produces a dependency file in the Makefile format (also produced by `gcc -M`). Is it possible to include this file into the generated makefiles either through a makefile inclusion or through cmake parsing the file?

Obviously I don't want to call `cargo` unless one of my source files changed.

Here is what I've got so far:

```
add_custom_command(
  OUTPUT
    ${CMAKE_CURRENT_BINARY_DIR}/rust/test/target/${RUST_PROFILE}/libtest.a
  COMMAND
    ${CMAKE_COMMAND} -E env SYSROOT=${CMAKE_SYSROOT} INCLUDES="${RUST_INCLUDES}" cargo build --manifest-path ${CMAKE_CURRENT_SOURCE_DIR}/rust/test/Cargo.toml --target-dir ${CMAKE_CURRENT_BINARY_DIR}/rust/test/target ${RUST_CARGO_FLAG}
  COMMAND
  )
add_custom_target(rust DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/rust/test/target/${RUST_PROFILE}/libbase.a)
```


Thanks
- Niklas

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake