robotology / osqp-eigen

Simple Eigen-C++ wrapper for OSQP library
https://robotology.github.io/osqp-eigen/
BSD 3-Clause "New" or "Revised" License
395 stars 118 forks source link

Do not run try_compile if OSQP_IS_V1 is already defined #145

Closed traversaro closed 1 year ago

traversaro commented 1 year ago

In some corner cases (see https://github.com/robotology/robotology-superbuild/issues/1451) try_compile is creating problems, so it is convenient not to call it at all by setting OSQP_IS_V1 as a CMake option if the OSQP version used is known.

fyi @gergondet

gergondet commented 1 year ago

Thanks for the heads-up @traversaro

If I understand correctly this fails because for a multi-config generator, CMake will try the compile (or at least try to configure an internal project) with all the configurations you provide and since OSQP installation is missing some of the configuration it will fail?

Could this be fixed by using CMAKE_TRY_COMPILE_CONFIGURATION?

traversaro commented 1 year ago

Could this be fixed by using CMAKE_TRY_COMPILE_CONFIGURATION?

In general, yes! In practice the specific problem in https://github.com/robotology/robotology-superbuild/pull/1452 was that the check is done at OsqpEigen CMake configuration step, that is invoked during the superbuild build step, but no information of the build configuration used by the superbuild step is passed to the OsqpEigen CMake configuration step. As anyhow we will eventually drop support for osqp <= 0.6.3 so this logic will go, this seemed the simplest solution.