diff --git a/cmake/OsqpEigenDependencies.cmake b/cmake/OsqpEigenDependencies.cmake index e2aa456..75727ed 100644 --- a/cmake/OsqpEigenDependencies.cmake +++ b/cmake/OsqpEigenDependencies.cmake @@ -11,7 +11,9 @@ include(OsqpEigenFindOptionalDependencies) ## Required Dependencies find_package(Eigen3 3.2.92 REQUIRED) find_package(osqp REQUIRED) -try_compile(OSQP_IS_V1 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/try-osqp.cpp LINK_LIBRARIES osqp::osqp) +if(NOT DEFINED OSQP_IS_V1) + try_compile(OSQP_IS_V1 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/try-osqp.cpp LINK_LIBRARIES osqp::osqp) +endif() #--------------------------------------------- ## Optional Dependencies