From 525bbe1db4b802a25e0ee24bb37be28341062990 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Mon, 27 Jan 2020 15:42:37 +0100 Subject: [PATCH 1/4] move osqp as public dependency in main CMakeLists.txt file --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c0883e8..fce6f41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,7 +83,8 @@ add_library(${LIBRARY_TARGET_NAME} ${${LIBRARY_TARGET_NAME}_SRC} ${${LIBRARY_TAR target_include_directories(${LIBRARY_TARGET_NAME} PUBLIC "$" "$") -target_link_libraries(${LIBRARY_TARGET_NAME} PRIVATE osqp::osqp Eigen3::Eigen) +target_link_libraries(${LIBRARY_TARGET_NAME} PRIVATE Eigen3::Eigen) +target_link_libraries(${LIBRARY_TARGET_NAME} PUBLIC osqp::osqp) add_library(OsqpEigen::OsqpEigen ALIAS OsqpEigen) @@ -91,6 +92,10 @@ set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES VERSION ${PROJECT_VERSION} PUBLIC_HEADER "${${LIBRARY_TARGET_NAME}_HDR}") +# List exported CMake package dependencies +set(OSQP_EIGEN_EXPORTED_DEPENDENCIES "") +list(APPEND OSQP_EIGEN_EXPORTED_DEPENDENCIES osqp) + install(TARGETS ${LIBRARY_TARGET_NAME} EXPORT ${PROJECT_NAME} COMPONENT runtime @@ -105,7 +110,7 @@ install_basic_package_files(${PROJECT_NAME} COMPATIBILITY SameMajorVersion VARS_PREFIX ${PROJECT_NAME} NO_CHECK_REQUIRED_COMPONENTS_MACRO - CONFIG_TEMPLATE ${CMAKE_SOURCE_DIR}/cmake/OsqpEigenConfig.cmake.in) + DEPENDENCIES ${OSQP_EIGEN_EXPORTED_DEPENDENCIES}) ## Testing option(BUILD_TESTING "Create tests using CMake" OFF) From 95822815ca2a29e737bbd9996ec8a906bbd65130 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Mon, 27 Jan 2020 15:43:48 +0100 Subject: [PATCH 2/4] update example and tests CMakeLists.txt files accordingly to 525bbe1 --- example/CMakeLists.txt | 3 ++- tests/CMakeLists.txt | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index e05130a..b92db2f 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -8,9 +8,10 @@ set (CMAKE_CXX_STANDARD 11) project(OsqpEigen-Example) find_package(OsqpEigen) +find_package(Eigen3) include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR}) #MPCExample add_executable(MPCExample src/MPCExample.cpp) -target_link_libraries(MPCExample OsqpEigen::OsqpEigen osqp::osqp) +target_link_libraries(MPCExample OsqpEigen::OsqpEigen) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b94a0dd..3356038 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -25,24 +25,24 @@ add_test(NAME SparseMatrixTest # QPTest add_executable(QPTest QPTest.cpp) -target_link_libraries(QPTest OsqpEigen::OsqpEigen osqp::osqp Eigen3::Eigen ${GTEST_LIBRARIES} pthread) +target_link_libraries(QPTest OsqpEigen::OsqpEigen Eigen3::Eigen ${GTEST_LIBRARIES} pthread) add_test(NAME QPTest COMMAND QPTest) # Update matrix add_executable(UpdateMatricesTest UpdateMatricesTest.cpp) -target_link_libraries(UpdateMatricesTest OsqpEigen::OsqpEigen osqp::osqp Eigen3::Eigen ${GTEST_LIBRARIES} pthread) +target_link_libraries(UpdateMatricesTest OsqpEigen::OsqpEigen Eigen3::Eigen ${GTEST_LIBRARIES} pthread) add_test(NAME UpdateMatricesTest COMMAND UpdateMatricesTest) # MPCTest add_executable(MPCTest MPCTest.cpp) -target_link_libraries(MPCTest OsqpEigen::OsqpEigen osqp::osqp Eigen3::Eigen ${GTEST_LIBRARIES} pthread) +target_link_libraries(MPCTest OsqpEigen::OsqpEigen Eigen3::Eigen ${GTEST_LIBRARIES} pthread) add_test(NAME MPCTest COMMAND MPCTest) # MPCTest update matrix add_executable(MPCUpdateMatricesTest UpdateMatricesTest.cpp) -target_link_libraries(MPCUpdateMatricesTest OsqpEigen::OsqpEigen osqp::osqp Eigen3::Eigen ${GTEST_LIBRARIES} pthread) +target_link_libraries(MPCUpdateMatricesTest OsqpEigen::OsqpEigen Eigen3::Eigen ${GTEST_LIBRARIES} pthread) add_test(NAME MPCUpdateMatricesTest COMMAND MPCUpdateMatricesTest) From 7da9f19c959c3e3d7e9d733dcef5dfacd38c2290 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Mon, 27 Jan 2020 15:46:19 +0100 Subject: [PATCH 3/4] remove OsqpEigenConfig.cmake.in file --- cmake/OsqpEigenConfig.cmake.in | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 cmake/OsqpEigenConfig.cmake.in diff --git a/cmake/OsqpEigenConfig.cmake.in b/cmake/OsqpEigenConfig.cmake.in deleted file mode 100644 index cbf12fa..0000000 --- a/cmake/OsqpEigenConfig.cmake.in +++ /dev/null @@ -1,12 +0,0 @@ -# Authors: Giulio Romualdi -# CopyPolicy: Released under the terms of the LGPLv2.1 or later - -if(NOT TARGET osqp-eigen) - # Eigen - find_package(Eigen3 REQUIRED) - - # osqp - find_package(osqp REQUIRED) - - include("${CMAKE_CURRENT_LIST_DIR}/OsqpEigenTargets.cmake") -endif() From 85755a393a1705f66e0ffe8a767eae79079127c8 Mon Sep 17 00:00:00 2001 From: Giulio Romualdi Date: Mon, 27 Jan 2020 15:45:17 +0100 Subject: [PATCH 4/4] Bump version from 0.5.1 -> 0.5.2 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fce6f41..ebdeb9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED 11) project(OsqpEigen LANGUAGES CXX - VERSION 0.5.1) + VERSION 0.5.2) # add GNU dirs include(GNUInstallDirs)