From 5cfb9fb75cfce6eafa415f92969e2ef85ad5b671 Mon Sep 17 00:00:00 2001 From: HackFisher Date: Fri, 23 Jan 2015 16:37:18 +0800 Subject: [PATCH] Fix CMake on OSX 10.10 (Can not find ZLIB) https://github.com/BitShares/fc/commit/6ddf1639c5862f25ac3e66a8287a2b820d5183ab Become ok after revert the position, any comment on this? ``` -- Found OpenSSL: /usr/local/Cellar/openssl/1.0.1i/lib/libssl.a;/usr/local/Cellar/openssl/1.0.1i/lib/libcrypto.a (found version "1.0.1i") CMake Error at /usr/local/Cellar/cmake/3.1.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:138 (message): Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.5") Call Stack (most recent call first): /usr/local/Cellar/cmake/3.1.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:374 (_FPHSA_FAILURE_MESSAGE) /usr/local/Cellar/cmake/3.1.0/share/cmake/Modules/FindZLIB.cmake:110 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) libraries/fc/CMakeLists.txt:94 (find_package) ``` --- CMakeLists.txt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 00aedc2..d417550 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,15 +86,6 @@ ENDIF() find_package(OpenSSL) -IF(APPLE) - # As of 10.10 yosemite, the OpenSSL static libraries shipped with os x have a dependency - # on zlib, so any time you link in openssl you also need to link zlib. . We really want to detect whether openssl was configured with the --no-zlib - # option or not when it was built, but that's difficult to do in practice, so we - # just always try to link it in on mac. - find_package( ZLIB REQUIRED ) -ENDIF(APPLE) - - set( CMAKE_FIND_LIBRARY_SUFFIXES ${ORIGINAL_LIB_SUFFIXES} ) option( UNITY_BUILD OFF ) @@ -354,6 +345,14 @@ if(WIN32) endif(WIN32) +IF(APPLE) + # As of 10.10 yosemite, the OpenSSL static libraries shipped with os x have a dependency + # on zlib, so any time you link in openssl you also need to link zlib. . We really want to detect whether openssl was configured with the --no-zlib + # option or not when it was built, but that's difficult to do in practice, so we + # just always try to link it in on mac. + find_package( ZLIB REQUIRED ) +ENDIF(APPLE) + SET(OPENSSL_CONF_TARGET ) IF(DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY) SET (OPENSSL_CONF_TARGET ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})