Skip to content

Commit

Permalink
Fix building static libs
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed May 22, 2021
1 parent 047cf7d commit 97b986f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/spatialindex/capi/sidx_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#pragma once

#ifndef SIDX_C_DLL
#if defined(_MSC_VER)
#if defined(_MSC_VER) && defined(SIDX_DLL_EXPORT)
# define SIDX_C_DLL __declspec(dllexport)
# define SIDX_DLL __declspec(dllexport)
#else
Expand Down
2 changes: 1 addition & 1 deletion include/spatialindex/tools/Tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#ifdef SIDX_DLL_EXPORT
#define SIDX_DLL __declspec(dllexport)
#else
#define SIDX_DLL __declspec(dllimport)
#define SIDX_DLL
#endif

// Nuke this annoying warning. See http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html
Expand Down
11 changes: 6 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,12 @@ if(MSVC)
target_compile_options(spatialindex PRIVATE /wd4068)
target_compile_options(spatialindex_c PRIVATE /wd4068)

target_compile_definitions(spatialindex_c PRIVATE -DSIDX_DLL_EXPORT=1)
target_compile_definitions(spatialindex PRIVATE -DSIDX_DLL_EXPORT=1)
if(NOT WITH_STATIC_SIDX)
target_compile_definitions(spatialindex PRIVATE -DSIDX_DLL_IMPORT=1)
target_compile_definitions(spatialindex_c PRIVATE -DSIDX_DLL_IMPORT=1)
if (BUILD_SHARED_LIBS)
target_compile_definitions(${SIDX_C_LIB_NAME} PRIVATE "-DSIDX_DLL_EXPORT=1")
target_compile_definitions(${SIDX_LIB_NAME} PRIVATE "-DSIDX_DLL_EXPORT=1")
else()
target_compile_definitions(spatialindex PRIVATE -DSIDX_DLL_IMPORT=1)
target_compile_definitions(spatialindex_c PRIVATE -DSIDX_DLL_IMPORT=1)
endif()
endif()

Expand Down

0 comments on commit 97b986f

Please sign in to comment.