PARQUET-1105: Remove libboost_system dependency for non MSVC
Author: Deepak Majeti <deepak.majeti@hpe.com>
Closes #406 from majetideepak/PARQUET-1105 and squashes the following commits:
cafd464 [Deepak Majeti] PARQUET-1105: Remove libboost_system dependency for non MSVC
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ca37b5f..c6989fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -497,10 +497,17 @@
if (PARQUET_BOOST_USE_SHARED)
set(BOOST_LINK_LIBS
boost_shared_regex)
+ if(MSVC)
+ set(BOOST_LINK_LIBS ${BOOST_LINK_LIBS}
+ boost_shared_system)
+ endif()
else()
set(BOOST_LINK_LIBS
- boost_static_regex
- boost_static_system)
+ boost_static_regex)
+ if(MSVC)
+ set(BOOST_LINK_LIBS ${BOOST_LINK_LIBS}
+ boost_static_system)
+ endif()
endif()
#############################################################
diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake
index 3662540..4de3089 100644
--- a/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cmake_modules/ThirdpartyToolchain.cmake
@@ -68,26 +68,40 @@
# force all boost libraries to dynamic link
add_definitions(-DBOOST_ALL_DYN_LINK)
+ find_package(Boost COMPONENTS regex system REQUIRED)
+ else()
+ find_package(Boost COMPONENTS regex REQUIRED)
endif()
- find_package(Boost COMPONENTS regex system REQUIRED)
if ("${UPPERCASE_BUILD_TYPE}" STREQUAL "DEBUG")
set(BOOST_SHARED_REGEX_LIBRARY ${Boost_REGEX_LIBRARY_DEBUG})
- set(BOOST_SHARED_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_DEBUG})
+ if (MSVC)
+ set(BOOST_SHARED_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_DEBUG})
+ endif()
else()
set(BOOST_SHARED_REGEX_LIBRARY ${Boost_REGEX_LIBRARY_RELEASE})
- set(BOOST_SHARED_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_RELEASE})
+ if (MSVC)
+ set(BOOST_SHARED_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_RELEASE})
+ endif()
endif()
else()
# Find static Boost libraries.
set(Boost_USE_STATIC_LIBS ON)
- find_package(Boost COMPONENTS regex system REQUIRED)
+ if (MSVC)
+ find_package(Boost COMPONENTS regex system REQUIRED)
+ else()
+ find_package(Boost COMPONENTS regex REQUIRED)
+ endif()
if ("${UPPERCASE_BUILD_TYPE}" STREQUAL "DEBUG")
set(BOOST_STATIC_REGEX_LIBRARY ${Boost_REGEX_LIBRARY_DEBUG})
- set(BOOST_STATIC_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_DEBUG})
+ if (MSVC)
+ set(BOOST_STATIC_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_DEBUG})
+ endif()
else()
set(BOOST_STATIC_REGEX_LIBRARY ${Boost_REGEX_LIBRARY_RELEASE})
- set(BOOST_STATIC_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_RELEASE})
+ if (MSVC)
+ set(BOOST_STATIC_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_RELEASE})
+ endif()
endif()
endif()
@@ -102,19 +116,18 @@
set_target_properties(boost_shared_regex
PROPERTIES IMPORTED_LOCATION "${BOOST_SHARED_REGEX_LIBRARY}")
endif()
- add_library(boost_shared_system SHARED IMPORTED)
if (MSVC)
+ add_library(boost_shared_system SHARED IMPORTED)
set_target_properties(boost_shared_system
PROPERTIES IMPORTED_IMPLIB "${BOOST_SHARED_SYSTEM_LIBRARY}")
- else()
- set_target_properties(boost_shared_system
- PROPERTIES IMPORTED_LOCATION "${BOOST_SHARED_SYSTEM_LIBRARY}")
endif()
else()
add_library(boost_static_regex STATIC IMPORTED)
set_target_properties(boost_static_regex PROPERTIES IMPORTED_LOCATION ${BOOST_STATIC_REGEX_LIBRARY})
- add_library(boost_static_system STATIC IMPORTED)
- set_target_properties(boost_static_system PROPERTIES IMPORTED_LOCATION ${BOOST_STATIC_SYSTEM_LIBRARY})
+ if (MSVC)
+ add_library(boost_static_system STATIC IMPORTED)
+ set_target_properties(boost_static_system PROPERTIES IMPORTED_LOCATION ${BOOST_STATIC_SYSTEM_LIBRARY})
+ endif()
endif()
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})