From a51b1065b5740405234c6670babbd01256fac405 Mon Sep 17 00:00:00 2001 From: Jonas Hall <41904024+hallfjonas@users.noreply.github.com> Date: Wed, 4 Oct 2023 16:50:47 -0400 Subject: [PATCH] Update CMakeLists.txt --- CMakeLists.txt | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bd8688..d71ac78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,6 +90,18 @@ message( "QPOASES_SCHUR ${QPOASES_SCHUR}\n" ) +## Some helper functions +function( CopyFiles TARGET_DIR OUTPUT_DIR TARGET_PATTERN) + + file(GLOB TARGET_FILES + ${OUTPUT_DIR}/${TARGET_PATTERN} + ) + file(COPY ${TARGET_FILES} DESTINATION ${}) + +endfunction() + +file(COPY ${MY_PUBLIC_HEADERS} DESTINATION myDestination) + ## ADD ALL EXTERNAL PROJECTS ------------------------------------------------------------ # external modules include(ExternalProject) @@ -184,13 +196,11 @@ ExternalProject_Add( CONFIGURE_COMMAND mkdir -p bin; BUILD_IN_SOURCE ON BUILD_COMMAND make ${qpOASES_MAKE_ARGS} src; - INSTALL_COMMAND "" -) - -install( - DIRECTORY ${CMAKE_BINARY_DIR}/external/src/qpoases/bin/ - DESTINATION ${CMAKE_INSTALL_PREFIX}/lib - FILES_MATCHING PATTERN "*libqpOASES.*" + INSTALL_COMMAND CopyFiles( + "${CMAKE_BINARY_DIR}/external/src/qpoases/bin/" + "${CMAKE_INSTALL_PREFIX}/lib" + "*libqpOASES.*" + ) ) set(qpoases_lib "-L${CMAKE_BINARY_DIR}/lib -lqpOASES") @@ -205,13 +215,11 @@ ExternalProject_Add( -DDLONG=OFF -DBUILD_SHARED_LIBS=ON BUILD_COMMAND cmake --build . - INSTALL_COMMAND "" -) - -install( - DIRECTORY ${CMAKE_BINARY_DIR}/external/src/osqp-build/out/ - DESTINATION ${CMAKE_INSTALL_PREFIX}/lib - FILES_MATCHING PATTERN "*libosqp.*" + INSTALL_COMMAND CopyFiles( + "${CMAKE_BINARY_DIR}/external/src/osqp-build/out/" + "${CMAKE_INSTALL_PREFIX}/lib" + "*libosqp.*" + ) ) set(osqp_lib "-L${CMAKE_BINARY_DIR}/lib -losqp") @@ -222,13 +230,11 @@ ExternalProject_Add( gtest DOWNLOAD_COMMAND cp -a ${CMAKE_SOURCE_DIR}/external/googletest/. ${CMAKE_BINARY_DIR}/external/src/gtest PREFIX external - INSTALL_COMMAND "" -) - -install( - DIRECTORY ${CMAKE_BINARY_DIR}/external/src/gtest-build/lib/ - DESTINATION ${CMAKE_INSTALL_PREFIX}/lib - FILES_MATCHING PATTERN "*libgtest.*" + INSTALL_COMMAND CopyFiles( + "${CMAKE_BINARY_DIR}/external/src/gtest-build/lib/" + "${CMAKE_INSTALL_PREFIX}/lib" + "*libgtest.*" + ) ) set(gtest_lib "-L${CMAKE_BINARY_DIR}/external/src/gtest-build/out -lgtest")