You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ch...@apache.org on 2018/04/21 02:17:09 UTC

[2/7] mesos git commit: Made CMake's `FindZLIB` module be able to find Zlib on Windows.

Made CMake's `FindZLIB` module be able to find Zlib on Windows.

This patch "install" ZLib in
`build/3rdparty/zlib-1.2.8/src/zlib-1.2.8-lib`, so we can set
`ZLIB_ROOT` to the directory to make `FindZLIB` be able to find the
include directory containing both `zlib.h` and `zconf.h`, as well as to
find the library directory containing the library files.

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


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

Branch: refs/heads/master
Commit: f905166465010306e21651a0d7fb0c75e9a597fb
Parents: 2adbfdc
Author: Chun-Hung Hsiao <ch...@apache.org>
Authored: Fri Apr 20 18:17:45 2018 -0700
Committer: Chun-Hung Hsiao <ch...@mesosphere.io>
Committed: Fri Apr 20 18:17:45 2018 -0700

----------------------------------------------------------------------
 3rdparty/CMakeLists.txt | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f9051664/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index e6bb407..2f768b3 100644
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -769,17 +769,23 @@ if (WIN32)
     set(ZLIB_SHARED 1)
   endif ()
 
+  # NOTE: We install Zlib under `${ZLIB_ROOT}-lib` so CMake's `FindZLIB` module
+  # can find all required headers and library files.
+  set(ZLIB_CMAKE_ARGS
+    ${CMAKE_C_FORWARD_ARGS}
+    -DCMAKE_INSTALL_PREFIX=${ZLIB_ROOT}-lib)
+
   set_target_properties(
     zlib PROPERTIES
-    INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_ROOT};${ZLIB_ROOT}-build")
+    INTERFACE_INCLUDE_DIRECTORIES ${ZLIB_ROOT}-lib/include)
 
   if (CMAKE_GENERATOR MATCHES "Visual Studio")
     set_target_properties(
       zlib PROPERTIES
-      IMPORTED_LOCATION_DEBUG ${ZLIB_ROOT}-build/Debug/zlib${ZLIB_STATIC}d${ZLIB_SHARED}${LIBRARY_SUFFIX}
-      IMPORTED_LOCATION_RELEASE ${ZLIB_ROOT}-build/Release/zlib${ZLIB_STATIC}${ZLIB_SHARED}${LIBRARY_SUFFIX}
-      IMPORTED_IMPLIB_DEBUG ${ZLIB_ROOT}-build/Debug/zlib${ZLIB_STATIC}d${CMAKE_IMPORT_LIBRARY_SUFFIX}
-      IMPORTED_IMPLIB_RELEASE ${ZLIB_ROOT}-build/Release/zlib${ZLIB_STATIC}${CMAKE_IMPORT_LIBRARY_SUFFIX})
+      IMPORTED_LOCATION_DEBUG ${ZLIB_ROOT}-lib/lib/zlib${ZLIB_STATIC}d${ZLIB_SHARED}${LIBRARY_SUFFIX}
+      IMPORTED_LOCATION_RELEASE ${ZLIB_ROOT}-lib/lib/zlib${ZLIB_STATIC}${ZLIB_SHARED}${LIBRARY_SUFFIX}
+      IMPORTED_IMPLIB_DEBUG ${ZLIB_ROOT}-lib/lib/zlib${ZLIB_STATIC}d${CMAKE_IMPORT_LIBRARY_SUFFIX}
+      IMPORTED_IMPLIB_RELEASE ${ZLIB_ROOT}-lib/lib/zlib${ZLIB_STATIC}${CMAKE_IMPORT_LIBRARY_SUFFIX})
   else ()
     # This is for single-configuration generators such as Ninja.
     if (CMAKE_BUILD_TYPE MATCHES Debug)
@@ -788,8 +794,8 @@ if (WIN32)
 
     set_target_properties(
       zlib PROPERTIES
-      IMPORTED_LOCATION ${ZLIB_ROOT}-build/zlib${ZLIB_STATIC}${ZLIB_SUFFIX}${ZLIB_SHARED}${LIBRARY_SUFFIX}
-      IMPORTED_IMPLIB ${ZLIB_ROOT}-build/zlib${ZLIB_STATIC}${ZLIB_SUFFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX})
+      IMPORTED_LOCATION ${ZLIB_ROOT}-lib/lib/zlib${ZLIB_STATIC}${ZLIB_SUFFIX}${ZLIB_SHARED}${LIBRARY_SUFFIX}
+      IMPORTED_IMPLIB ${ZLIB_ROOT}-lib/lib/zlib${ZLIB_STATIC}${ZLIB_SUFFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX})
   endif ()
 
   MAKE_INCLUDE_DIR(zlib)
@@ -799,8 +805,8 @@ if (WIN32)
     ${ZLIB_TARGET}
     PREFIX            ${ZLIB_CMAKE_ROOT}
     BUILD_BYPRODUCTS  ${ZLIB_BYPRODUCTS}
-    CMAKE_ARGS        ${CMAKE_C_FORWARD_ARGS}
-    INSTALL_COMMAND   ${CMAKE_NOOP}
+    CMAKE_ARGS        ${ZLIB_CMAKE_ARGS}
+    INSTALL_DIR       ${ZLIB_ROOT}-lib
     URL               ${ZLIB_URL}
     URL_HASH          ${ZLIB_HASH})
 else ()