Clarabel.cpp
Clarabel.cpp copied to clipboard
Add support for usage of Clarabel.cpp via `add_subdirectory`
A common pattern is to have C++ dependencies provisioned via git submodule. These dependencies can then be included via add_subdirectory, however this fails with Clarabel.cpp because Clarabel.cpp expects to be the top-level project:
if(CMAKE_BUILD_TYPE MATCHES Release)
set(clarabel_c_build_flags "--release")
set(clarabel_c_output_directory "${CMAKE_SOURCE_DIR}/rust_wrapper/target/release")
else()
set(clarabel_c_build_flags "")
set(clarabel_c_output_directory "${CMAKE_SOURCE_DIR}/rust_wrapper/target/debug")
endif()
If Clarabel.cpp is not the top-level project, it will fail to build, because directories like rust_wrapper won't be found.