From 3a90c96eeefc664bf3b335e6fe1f30b9e0d8697b Mon Sep 17 00:00:00 2001 From: Martin Beseda <martin.beseda@vsb.cz> Date: Tue, 18 Dec 2018 15:08:07 +0100 Subject: [PATCH] FIX: lib4neuro library can be compiled statically from now --- CMakeLists.txt | 4 ++++ src/CMakeLists.txt | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b3dfd4b..07ccb928 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,10 @@ if(NOT DEPENDENCIES_LINK_TYPE AND NOT ENV{DEPENDENCIES_LINK_TYPE}) message(FATAL_ERROR "Please, set the variable DEPENDENCIES_LINK_TYPE to either 'static' or 'shared'!") endif() +if(ENV{DEPENDENCIES_LINK_TYPE}) + set(DEPENDENCIES_LINK_TYPE ENV{DEPENDENCIES_LINK_TYPE}) +endif() + #--------------------------------# # Setting C++ compiler flags # #--------------------------------# diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b3a69cfd..364be4ee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,10 +7,16 @@ if ("${BUILD_EXAMPLES}" STREQUAL "yes") endif () if ("${BUILD_LIB}" STREQUAL "yes") + + set(LIB_TYPE "STATIC") + if(DEPENDENCIES_LINK_TYPE STREQUAL "shared") + set(LIB_TYPE "SHARED") + endif() + add_library( exprtk_wrap - SHARED + ${LIB_TYPE} General/ExprtkWrapper.cpp Exception/Exceptions.cpp @@ -31,7 +37,11 @@ if ("${BUILD_LIB}" STREQUAL "yes") ${Boost_LIBRARIES} ) - add_library(lib4neuro SHARED + add_library( + lib4neuro + + ${LIB_TYPE} + Neuron/Neuron.cpp Neuron/NeuronBinary.cpp Neuron/NeuronConstant.cpp -- GitLab