From 898417196f8130b8d971de0f07d05172f0aabcb9 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Thu, 18 Apr 2019 20:25:55 +0200 Subject: [PATCH] alternative solution to DLL build in MSVC --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 186dabaf4..7856ba582 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,6 +130,14 @@ if(MSVC) endif() endif() +# If building DLLs in MSVC, we need to avoid EIGEN_STATIC_ASSERT() +# or explicit instantiation will generate build errors. +# See: https://bitbucket.org/gtborg/gtsam/issues/417/fail-to-build-on-msvc-2017 +# +if(MSVC AND BUILD_SHARED_LIBS) + list(APPEND GTSAM_COMPILE_DEFINITIONS_PUBLIC EIGEN_NO_STATIC_ASSERT) +endif() + # Store these in variables so they are automatically replicated in GTSAMConfig.cmake and such. set(BOOST_FIND_MINIMUM_VERSION 1.43) set(BOOST_FIND_MINIMUM_COMPONENTS serialization system filesystem thread program_options date_time timer chrono regex)