mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From josep...@apache.org
Subject [19/42] mesos git commit: CMake: Updated stout test linking rules.
Date Sun, 03 Sep 2017 12:51:41 GMT
CMake: Updated stout test linking rules.

Now that all the dependencies of tests are import or interface
libraries with their properties properly defined within their respective
targets, we can update the linking rules of the tests to point to those
dependent targets.  CMake will do the rest for us.

Review: https://reviews.apache.org/r/61347/


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

Branch: refs/heads/master
Commit: 5d4e1056cce15d80ccda904a5b7c219dadbf9c64
Parents: 4c62721
Author: Andrew Schwartzmeyer <andrew@schwartzmeyer.com>
Authored: Sat Sep 2 13:00:53 2017 -0700
Committer: Joseph Wu <josephwu@apache.org>
Committed: Sun Sep 3 05:51:07 2017 -0700

----------------------------------------------------------------------
 3rdparty/stout/cmake/StoutTestsConfigure.cmake | 96 ---------------------
 3rdparty/stout/tests/CMakeLists.txt            | 29 ++-----
 2 files changed, 8 insertions(+), 117 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5d4e1056/3rdparty/stout/cmake/StoutTestsConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/stout/cmake/StoutTestsConfigure.cmake b/3rdparty/stout/cmake/StoutTestsConfigure.cmake
deleted file mode 100644
index b6e9902..0000000
--- a/3rdparty/stout/cmake/StoutTestsConfigure.cmake
+++ /dev/null
@@ -1,96 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-###############################################################
-# Defines the variables useful for tests, and exports them to the scope of
-# any file includes this file. There are a few important consequence of this:
-#
-#   * This file MUST be included before the third-party dependencies like gmock
-#     are configured/built/downloaded (if you're doing this). If this code isn't
-#     run first, then we won't know (e.g.) what folders to unpack the code to.
-#   * This file ONLY defines and exports variables for third-party dependencies
-#     that are required by the test suite, but are not a dependency that
-#     libprocess core takes. That is, this file handles the gmock dependency,
-#     but not the glog dependency (which the process library itself takes a
-#     dependency on).
-#   * This file and the config file for the libprocess "core" dependencies
-#     (e.g. glog, boost, etc.) are separate so that we can export the variables
-#     for the core dependencies (e.g., where to find the .so/.dll files) without
-#     having to also export the variables for test-only dependencies.
-
-# COMPILER CONFIGURATION.
-#########################
-EXTERNAL("googletest" ${GOOGLETEST_VERSION} "${MESOS_3RDPARTY_BIN}")
-
-# Convenience variables for include directories of third-party dependencies.
-set(GMOCK_INCLUDE_DIR ${GOOGLETEST_ROOT}/googlemock/include)
-set(GTEST_INCLUDE_DIR ${GOOGLETEST_ROOT}/googletest/include)
-
-# Convenience variables for `lib` directories of built third-party dependencies.
-if (WIN32)
-  set(GMOCK_LIB_DIR ${GOOGLETEST_ROOT}-build/googlemock)
-  set(GTEST_LIB_DIR ${GOOGLETEST_ROOT}-build/googlemock/gtest)
-else ()
-  set(GMOCK_LIB_DIR ${GOOGLETEST_ROOT}-lib/lib)
-  set(GTEST_LIB_DIR ${GOOGLETEST_ROOT}-lib/lib/gtest)
-endif ()
-
-# Convenience variables for "lflags", the symbols we pass to CMake to generate
-# things like `-L/path/to/glog` or `-lglog`.
-set(GMOCK_LFLAG gmock)
-set(GTEST_LFLAG gtest)
-
-# DEFINE PROCESS LIBRARY DEPENDENCIES. Tells the process library build targets
-# download/configure/build all third-party libraries before attempting to build.
-################################################################################
-set(STOUT_TEST_DEPENDENCIES
-  ${STOUT_TEST_DEPENDENCIES}
-  ${GOOGLETEST_TARGET}
-  )
-
-# DEFINE THIRD-PARTY INCLUDE DIRECTORIES. Tells compiler toolchain where to get
-# headers for our third party libs (e.g., -I/path/to/glog on Linux)..
-###############################################################################
-set(STOUT_TEST_3RDPARTY_INCLUDE_DIRS
-  ${STOUT_TEST_3RDPARTY_INCLUDE_DIRS}
-  ${GMOCK_INCLUDE_DIR}
-  ${GTEST_INCLUDE_DIR}
-  )
-
-# DEFINE THIRD-PARTY LIB INSTALL DIRECTORIES. Used to tell the compiler
-# toolchain where to find our third party libs (e.g., -L/path/to/glog on
-# Linux).
-########################################################################
-set(STOUT_TEST_LIB_DIRS
-  ${STOUT_TEST_LIB_DIRS}
-  ${GMOCK_LIB_DIR}
-  ${GTEST_LIB_DIR}
-  )
-
-# DEFINE THIRD-PARTY LIBS. Used to generate flags that the linker uses to
-# include our third-party libs (e.g., -lglog on Linux).
-#########################################################################
-set(STOUT_TEST_LIBS
-  ${STOUT_TEST_LIBS}
-  ${GMOCK_LFLAG}
-  )
-
-if (NOT WIN32)
-  set(STOUT_TEST_LIBS
-    ${STOUT_TEST_LIBS}
-    ${GTEST_LFLAG}
-    )
-endif ()

http://git-wip-us.apache.org/repos/asf/mesos/blob/5d4e1056/3rdparty/stout/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/CMakeLists.txt b/3rdparty/stout/tests/CMakeLists.txt
index f18dabd..eb1c97e 100644
--- a/3rdparty/stout/tests/CMakeLists.txt
+++ b/3rdparty/stout/tests/CMakeLists.txt
@@ -14,9 +14,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# TODO(andschwa): Remove this when gmock and gtest can be included.
-include(StoutTestsConfigure)
-
 # STOUT TESTS.
 ##############
 set(STOUT_ROOT_TESTS_SRC
@@ -87,7 +84,7 @@ if (NOT WIN32)
     )
 endif ()
 
-if (LINUX)
+if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
   set(STOUT_ROOT_TESTS_SRC ${STOUT_ROOT_TESTS_SRC} proc_tests.cpp)
 endif ()
 
@@ -102,25 +99,15 @@ set(STOUT_TESTS_SRC
 ##############################################################################
 add_custom_command(
   OUTPUT protobuf_tests.pb.h protobuf_tests.pb.cc
-  COMMAND ${PROTOC}
-    -I${CMAKE_SOURCE_DIR}/3rdparty/stout/tests
-    --cpp_out=.
-    ${CMAKE_SOURCE_DIR}/3rdparty/stout/tests/protobuf_tests.proto
-  DEPENDS ${CMAKE_SOURCE_DIR}/3rdparty/stout/tests/protobuf_tests.proto)
-
-# TODO(andschwa): Remove when gmock and gtest are top-level targets.
-link_directories(${STOUT_TEST_LIB_DIRS})
+  COMMAND protoc
+    -I${CMAKE_CURRENT_SOURCE_DIR}
+    --cpp_out=${CMAKE_CURRENT_BINARY_DIR}
+    ${CMAKE_CURRENT_SOURCE_DIR}/protobuf_tests.proto
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/protobuf_tests.proto)
 
 add_executable(stout-tests EXCLUDE_FROM_ALL ${STOUT_TESTS_SRC})
-
-# TODO(andschwa): Remove when gmock and gtest are top-level targets.
-add_dependencies(stout-tests ${STOUT_TEST_DEPENDENCIES})
-target_include_directories(stout-tests PRIVATE
-  ${CMAKE_CURRENT_BINARY_DIR}
-  ${STOUT_TEST_3RDPARTY_INCLUDE_DIRS})
-
-# TODO(andschwa): Link to gmock and gtest explicitly.
-target_link_libraries(stout-tests stout ${STOUT_TEST_LIBS})
+target_link_libraries(stout-tests PRIVATE stout googletest)
+target_include_directories(stout-tests PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
 
 # ADD TEST TARGET (runs when you do, e.g., `make check`).
 #########################################################


Mime
View raw message