Skip to content

Commit

Permalink
cmake: fix dll export
Browse files Browse the repository at this point in the history
On win32 dll were only properly exported for the double precision
variant because the automatically added cminpack_EXPORTS was the only
one take into account from cminpack.h
now we use CMINPACK_DLL_EXPORTS for all variants to fix the build
  • Loading branch information
xantares committed Mar 14, 2021
1 parent de5849d commit dceef97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Expand Up @@ -107,7 +107,9 @@ foreach (cminpack_lib ${cminpack_libs})
target_compile_definitions (cminpackld PUBLIC __cminpack_long_double__)
endif ()

if (NOT BUILD_SHARED_LIBS AND WIN32)
if (BUILD_SHARED_LIBS)
target_compile_definitions (${cminpack_lib} PRIVATE CMINPACK_DLL_EXPORTS)
else ()
target_compile_definitions (${cminpack_lib} PUBLIC CMINPACK_NO_DLL)
endif ()

Expand Down
4 changes: 2 additions & 2 deletions cminpack.h
Expand Up @@ -59,8 +59,8 @@ building a DLL on windows.
#define CMINPACK_DECLSPEC_IMPORT _Import
#endif

#if !defined(CMINPACK_NO_DLL) && (defined(__WIN32__) || defined(WIN32) || defined (_WIN32))
#if defined(cminpack_EXPORTS) || defined(CMINPACK_EXPORTS) || defined(CMINPACK_DLL_EXPORTS)
#if !defined(CMINPACK_NO_DLL) && defined(_WIN32)
#if defined(CMINPACK_DLL_EXPORTS)
#define CMINPACK_EXPORT CMINPACK_DECLSPEC_EXPORT
#else
#define CMINPACK_EXPORT CMINPACK_DECLSPEC_IMPORT
Expand Down

0 comments on commit dceef97

Please sign in to comment.