You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2018/05/30 20:05:00 UTC

[incubator-pulsar] 02/03: Fixes in CMakeFiles to automate build on macos (#1787)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git

commit c3d42a594a2501f1ccf98bb57085560165ee4458
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Wed May 16 14:58:23 2018 -0700

    Fixes in CMakeFiles to automate build on macos (#1787)
    
    * Fixes in CMakeFiles to automate build on macos
    
    * Also fix the lib name for boost-python3
    
    * Added option to disable tests compilation
---
 pulsar-client-cpp/CMakeLists.txt | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/pulsar-client-cpp/CMakeLists.txt b/pulsar-client-cpp/CMakeLists.txt
index d71590e..5ada575 100644
--- a/pulsar-client-cpp/CMakeLists.txt
+++ b/pulsar-client-cpp/CMakeLists.txt
@@ -21,6 +21,9 @@ cmake_minimum_required(VERSION 2.8)
 project (pulsar-cpp)
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules")
 
+option(BUILD_TESTS "Build tests" ON)
+MESSAGE(STATUS "BUILD_TESTS:  " ${BUILD_TESTS})
+
 option(LINK_STATIC "Link against static libraries" OFF)
 MESSAGE(STATUS "LINK_STATIC:  " ${LINK_STATIC})
 
@@ -98,10 +101,10 @@ if (PYTHONLIBS_VERSION_STRING MATCHES "^3.+$")
     list(GET PYTHONLIBS_VERSION_NO_LIST 1 PYTHONLIBS_VERSION_MINOR)
     set(BOOST_PYTHON_NAME_POSTFIX ${PYTHONLIBS_VERSION_MAJOR}${PYTHONLIBS_VERSION_MINOR})
     # For python3 the lib name is boost_python3
-    set(BOOST_PYTHON_NAME_LIST python3;python3-mt;python-py${BOOST_PYTHON_NAME_POSTFIX})
+    set(BOOST_PYTHON_NAME_LIST python3;python3-mt;python-py${BOOST_PYTHON_NAME_POSTFIX};python${BOOST_PYTHON_NAME_POSTFIX}-mt)
 else ()
     # Regular boost_python
-    set(BOOST_PYTHON_NAME_LIST python;python-mt;python-py27)
+    set(BOOST_PYTHON_NAME_LIST python;python-mt;python-py27;python27-mt)
 endif ()
 
 foreach (BOOST_PYTHON_NAME IN LISTS BOOST_PYTHON_NAME_LIST)
@@ -119,10 +122,18 @@ endif ()
 find_package(Boost REQUIRED COMPONENTS program_options filesystem regex
                                        thread system ${BOOST_PYTHON_NAME_FOUND})
 
+if (APPLE)
+    set(OPENSSL_INCLUDE_DIR /usr/local/opt/openssl/include/)
+    set(OPENSSL_ROOT_DIR /usr/local/opt/openssl/)
+endif ()
 
 find_package(OpenSSL REQUIRED)
-find_path(GTEST_INCLUDE_PATH gtest/gtest.h)
-find_path(GMOCK_INCLUDE_PATH gmock/gmock.h)
+
+if (BUILD_TESTS)
+    find_path(GTEST_INCLUDE_PATH gtest/gtest.h)
+    find_path(GMOCK_INCLUDE_PATH gmock/gmock.h)
+endif ()
+
 find_path(JSON_INCLUDE_PATH jsoncpp)
 find_path(LOG4CXX_INCLUDE_PATH log4cxx/logger.h)
 
@@ -196,7 +207,11 @@ set(CLIENT_LIBS
 add_subdirectory(lib)
 add_subdirectory(perf)
 add_subdirectory(examples)
-add_subdirectory(tests)
+
+if (BUILD_TESTS)
+    add_subdirectory(tests)
+endif()
+
 add_subdirectory(python)
 
 # `make format` option

-- 
To stop receiving notification emails like this one, please contact
mmerli@apache.org.