arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject arrow git commit: ARROW-681: [C++] Disable boost's autolinking if shared boost is used …
Date Wed, 22 Mar 2017 14:05:26 GMT
Repository: arrow
Updated Branches:
  refs/heads/master 96734efb7 -> b179ad2d8


ARROW-681: [C++] Disable boost's autolinking if shared boost is used …

…on Windows; Correct linking with IMPORTED_IMPLIB of 3rd party shared libs on WIndows.

Author: Max Risuhin <risuhin.max@gmail.com>

Closes #415 from MaxRis/master and squashes the following commits:

9fd851d [Max Risuhin] ARROW-681: [C++] Disable boost's autolinking if shared boost is used
on Windows; Correct linking with IMPORTED_IMPLIB of 3rd party shared libs on WIndows.


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/b179ad2d
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/b179ad2d
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/b179ad2d

Branch: refs/heads/master
Commit: b179ad2d80c3f3c1ab81bfa9ff0c343fb47b148a
Parents: 96734ef
Author: Max Risuhin <risuhin.max@gmail.com>
Authored: Wed Mar 22 10:05:19 2017 -0400
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Wed Mar 22 10:05:19 2017 -0400

----------------------------------------------------------------------
 cpp/CMakeLists.txt | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/b179ad2d/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 956658a..84158cc 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -379,8 +379,15 @@ function(ADD_THIRDPARTY_LIB LIB_NAME)
 
     SET(AUG_LIB_NAME "${LIB_NAME}_shared")
     add_library(${AUG_LIB_NAME} SHARED IMPORTED)
-    set_target_properties(${AUG_LIB_NAME}
-      PROPERTIES IMPORTED_LOCATION "${ARG_SHARED_LIB}")
+
+    if(MSVC)
+        # Mark the ”.lib” location as part of a Windows DLL
+        set_target_properties(${AUG_LIB_NAME}
+            PROPERTIES IMPORTED_IMPLIB "${ARG_SHARED_LIB}")
+    else()
+        set_target_properties(${AUG_LIB_NAME}
+            PROPERTIES IMPORTED_LOCATION "${ARG_SHARED_LIB}")
+    endif()
     message("Added shared library dependency ${LIB_NAME}: ${ARG_SHARED_LIB}")
   elseif(ARG_STATIC_LIB)
     add_library(${LIB_NAME} STATIC IMPORTED)
@@ -397,8 +404,15 @@ function(ADD_THIRDPARTY_LIB LIB_NAME)
       PROPERTIES IMPORTED_LOCATION "${ARG_SHARED_LIB}")
     SET(AUG_LIB_NAME "${LIB_NAME}_shared")
     add_library(${AUG_LIB_NAME} SHARED IMPORTED)
-    set_target_properties(${AUG_LIB_NAME}
-      PROPERTIES IMPORTED_LOCATION "${ARG_SHARED_LIB}")
+
+    if(MSVC)
+        # Mark the ”.lib” location as part of a Windows DLL
+        set_target_properties(${AUG_LIB_NAME}
+            PROPERTIES IMPORTED_IMPLIB "${ARG_SHARED_LIB}")
+    else()
+        set_target_properties(${AUG_LIB_NAME}
+            PROPERTIES IMPORTED_LOCATION "${ARG_SHARED_LIB}")
+    endif()
     message("Added shared library dependency ${LIB_NAME}: ${ARG_SHARED_LIB}")
   else()
     message(FATAL_ERROR "No static or shared library provided for ${LIB_NAME}")
@@ -418,6 +432,15 @@ set(Boost_USE_MULTITHREADED ON)
 if (ARROW_BOOST_USE_SHARED)
   # Find shared Boost libraries.
   set(Boost_USE_STATIC_LIBS OFF)
+
+  if(MSVC)
+    # disable autolinking in boost
+    add_definitions(-DBOOST_ALL_NO_LIB)
+
+    # force all boost libraries to dynamic link
+    add_definitions(-DBOOST_ALL_DYN_LINK)
+  endif()
+
   find_package(Boost COMPONENTS system filesystem REQUIRED)
   if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
     set(BOOST_SHARED_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_DEBUG})


Mime
View raw message