From 3af8e598efac75441d5ef831748e9b5e8b4b4515 Mon Sep 17 00:00:00 2001
From: jvallve <jvallve@iri.upc.edu>
Date: Thu, 12 May 2022 18:02:54 +0200
Subject: [PATCH] strange linking bug fixed

---
 CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f2c66cc..0a00252 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
 project(wolf_ros_imu)
 
 ## Compile as C++14
-add_compile_options(-std=c++14)
+add_compile_options(-std=c++14) 
+# -fPIC and -rdynamic ensure unique singleton instance across shared libraries (for factories) see: https://stackoverflow.com/a/8626922
+SET(CMAKE_CXX_FLAGS "-fPIC -rdynamic")
 
 ## Find catkin macros and libraries
 ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
-- 
GitLab