From cb49b52c17e0b638c88ff92f4c59e347cd82a332 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Wed, 17 Feb 2021 10:09:19 +0100 Subject: [PATCH] Permit to compile qpOASES as a shared library in CMake --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index adb111f..2367b1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,9 +54,12 @@ IF( NOT CMAKE_BUILD_TYPE ) ) ENDIF( NOT CMAKE_BUILD_TYPE ) - +option(BUILD_SHARED_LIBS "If ON, build shared library instead of static" OFF) option(QPOASES_BUILD_EXAMPLES "Build examples." ON) +IF(BUILD_SHARED_LIBS AND WIN32) + MESSAGE(FATAL_ERROR "Compiling qpOASES as a shared library in Windows is not supported.") +ENDIF() ############################################################ #################### compiler flags ######################## @@ -104,7 +107,7 @@ INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include) FILE(GLOB SRC src/*.cpp) # library -ADD_LIBRARY(qpOASES STATIC ${SRC}) +ADD_LIBRARY(qpOASES ${SRC}) INSTALL(TARGETS qpOASES LIBRARY DESTINATION lib ARCHIVE DESTINATION lib