Ingo Müller created ARROW-6421:
----------------------------------

             Summary: Headers of system Boost not found in non-standard location
                 Key: ARROW-6421
                 URL: https://issues.apache.org/jira/browse/ARROW-6421
             Project: Apache Arrow
          Issue Type: Bug
          Components: C++
            Reporter: Ingo Müller


On a system that does not have boost installed in a default location, but in a 
non-default one, the boost headers are not found during compilation. This is 
true even though CMake correctly finds the Boost installation, e.g., through 
CMAKE_PREFIX_PATH.

The problem is the function ADD_ARROW_LIB LIB_NAME in 
cpp/cmake_modules/BuildUtils.cmake, which defines a target "{$LIB_NAME]_objlib" 
without the required dependencies (without any dependencies, actually). The 
required _compile-time_ dependencies are specified as properties of the 
corresponding_"_targets", for example, of the Boost::filesystem target. They 
should be added as dependencies using target_link_libraries (even though the 
name suggests that this is only for _link-time_ dependencies).

The following patch solves the problem, but might not be the best solution:
{noformat}
diff --git a/cpp/cmake_modules/BuildUtils.cmake 
b/cpp/cmake_modules/BuildUtils.cmake
index ecfa593a0..c2b744766 100644
--- a/cpp/cmake_modules/BuildUtils.cmake
+++ b/cpp/cmake_modules/BuildUtils.cmake
@@ -251,6 +251,13 @@ function(ADD_ARROW_LIB LIB_NAME)
                                      SOVERSION
                                      "${ARROW_SO_VERSION}")+    
target_link_libraries(${LIB_NAME}_objlib
+                          LINK_PUBLIC
+                          "$<BUILD_INTERFACE:${ARG_SHARED_LINK_LIBS}>"
+                          
"$<INSTALL_INTERFACE:${ARG_SHARED_INSTALL_INTERFACE_LIBS}>"
+                          LINK_PRIVATE
+                          ${ARG_SHARED_PRIVATE_LINK_LIBS})
+
     target_link_libraries(${LIB_NAME}_shared
                           LINK_PUBLIC
                           
"$<BUILD_INTERFACE:${ARG_SHARED_LINK_LIBS}>"{noformat}

{{Steps to reproduce:}}
 # Make sure you don't have boost installed.
 # Install boost to /opt/boost-1.70.0 (or similar).
 # export CMAKE_PREFIX_PATH=/opt/boost-1.70.0
 # Compile the cpp project without setting -DBOOST_SOURCE or similar. Make sure 
CMake found your Boost installation in /opt



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to