mirror of
https://github.com/apache/impala.git
synced 2025-12-19 18:12:08 -05:00
If Impala was built with --build_shared_libs, some thirdparty libraries were still statically linked; this could cause runtime errors if the libraries were also linked into a .so. This patch fixes that issue (for gflags, glog and protobuf at least) by ensuring that build_shared_libs is respected for those libraries. * Standardize thirdparty library handling w/CMake by adding IMPALA_ADD_THIRDPARTY_LIB. This creates a symbolic name for each library, allowing us to switch the underlying library files (e.g. change from static to dynamic linking) without having to individually change the link clauses for each target. * Remove most cases of add_library() from cmake_modules/* - that is all handled by IMPALA_ADD_THIRDPARTY_LIB. * Add shared library detection for a couple of thirdparty dependencies (many only detect static libraries), just to prove the concept. * All thirdparty libraries now print a standard set of messages. For example: -- ----------> Adding thirdparty library protoc. <---------- -- Header files: /data/henry/src/cloudera/impala-toolchain/protobuf-2.6.1/include -- Added shared library dependency protoc: /data/henry/src/cloudera/impala-toolchain/protobuf-2.6.1/lib/libprotoc.so -- ----------> Adding thirdparty library libev. <---------- -- Header files: /data/henry/src/cloudera/impala-toolchain/libev-4.20/include -- Added shared library dependency libev: /data/henry/src/cloudera/impala-toolchain/libev-4.20/lib/libev.so * Some libraries don't quite fit this pattern (LLVM and Boost) - leave them as is for now. * Remove FindOpenSSL.cmake - the toolchain one is more modern. Change-Id: Ib7a6bc5610aaf2450f91348d94cfb984c6a4b78d Reviewed-on: http://gerrit.cloudera.org:8080/7418 Tested-by: Impala Public Jenkins Reviewed-by: Tim Armstrong <tarmstrong@cloudera.com>
75 lines
2.7 KiB
CMake
75 lines
2.7 KiB
CMake
# Copyright (c) 2009-2010 Volvox Development Team
|
|
#
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
# in the Software without restriction, including without limitation the rights
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
# furnished to do so, subject to the following conditions:
|
|
#
|
|
# The above copyright notice and this permission notice shall be included in
|
|
# all copies or substantial portions of the Software.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
# THE SOFTWARE.
|
|
#
|
|
# Author: Konstantin Lepa <konstantin.lepa@gmail.com>
|
|
#
|
|
# Find the Google Test Framework
|
|
#
|
|
# GTEST_ROOT hints a location
|
|
#
|
|
# This module defines
|
|
# GTEST_INCLUDE_DIR, where to find gtest include files, etc.
|
|
# GTEST_LIBRARIES, the libraries to link against to use gtest.
|
|
# GTEST_FOUND, If false, do not try to use gtest.
|
|
# GTEST_STATIC_LIB, where to find the GTest library.
|
|
|
|
set(GTEST_H gtest/gtest.h)
|
|
|
|
find_path(GTEST_INCLUDE_DIR ${GTEST_H}
|
|
PATHS ${GTEST_ROOT}/include
|
|
$ENV{IMPALA_HOME}/thirdparty/gtest-$ENV{IMPALA_GTEST_VERSION}/include
|
|
NO_DEFAULT_PATH
|
|
DOC "Path to the ${GTEST_H} file"
|
|
)
|
|
|
|
find_library(GTEST_STATIC_LIB NAMES libgtest.a
|
|
PATHS ${GTEST_ROOT}/lib
|
|
$ENV{IMPALA_HOME}/thirdparty/gtest-$ENV{IMPALA_GTEST_VERSION}
|
|
NO_DEFAULT_PATH
|
|
DOC "Google's framework for writing C++ tests (gtest)"
|
|
)
|
|
|
|
find_library(GTEST_MAIN_LIBRARY NAMES libgtest_main.a
|
|
PATHS ${GTEST_ROOT}/lib
|
|
$ENV{IMPALA_HOME}/thirdparty/gtest-$ENV{IMPALA_GTEST_VERSION}
|
|
NO_DEFAULT_PATH
|
|
DOC "Google's framework for writing C++ tests (gtest_main)"
|
|
)
|
|
|
|
if(GTEST_INCLUDE_DIR AND GTEST_STATIC_LIB AND GTEST_MAIN_LIBRARY)
|
|
set(GTEST_LIBRARIES ${GTEST_STATIC_LIB} ${GTEST_MAIN_LIBRARY})
|
|
set(GTEST_FOUND TRUE)
|
|
else(GTEST_INCLUDE_DIR AND GTEST_STATIC_LIB AND GTEST_MAIN_LIBRARY)
|
|
set(GTEST_FOUND FALSE)
|
|
endif(GTEST_INCLUDE_DIR AND GTEST_STATIC_LIB AND GTEST_MAIN_LIBRARY)
|
|
|
|
if(GTEST_FOUND)
|
|
if(NOT GTEST_FIND_QUIETLY)
|
|
message(STATUS "Found GTest: ${GTEST_LIBRARIES}")
|
|
endif(NOT GTEST_FIND_QUIETLY)
|
|
else(GTEST_FOUND)
|
|
message(FATAL_ERROR "Could not find the GTest Library")
|
|
endif(GTEST_FOUND)
|
|
|
|
mark_as_advanced(
|
|
GTEST_INCLUDE_DIR
|
|
GTEST_LIBRARIES
|
|
GTEST_STATIC_LIB)
|