View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015075CMakeCMakepublic2014-08-10 07:522015-06-01 08:38
ReporterCameron Garnham 
Assigned ToBrad King 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformApple MacOSOS XOS Version10.9.4
Product VersionCMake 3.0 
Target VersionCMake 3.2Fixed in VersionCMake 3.2 
Summary0015075: Wrong version found when overriding System OpenSSL with custom path (-DCMAKE_PREFIX_PATH=)
Descriptioncmake should report the latest version of OpenSSL found on the prefix path.
however the pgk-config version overrides a custom path's version.
Steps To Reproduce(OS Mac X)

$ brew install openssl
(will install to /usr/local/opt/openssl as an optional package)

$ cmake -DCMAKE_PREFIX_PATH=/usr/local/opt/openssl

cmake will report:
 "-- Found OpenSSL: /usr/local/opt/openssl/lib/libssl.dylib;/usr/local/opt/openssl/lib/libcrypto.dylib (found version "0.9.8y")"
yet the version in:
/usr/local/opt/openssl/include/openssl is: OPENSSL_VERSION_NUMBER 0x1000109fL

TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0036586)
Cameron Garnham (reporter)
2014-08-10 08:10

misleading title: perhaps edit to:

0015075: Wrong version found when overriding System OpenSSL with custom path (-DCMAKE_PREFIX_PATH=)

and description:

cmake should report the latest version of OpenSSL found on the prefix path.
however the pgk-config version overrides a custom path's version.
(0036591)
Brad King (manager)
2014-08-11 10:18

So the right location of OpenSSL is found, but the wrong value of OPENSSL_VERSION is reported?

It appears that the computation for OPENSSL_VERSION trusts the pkg-config output regardless of where the headers and libraries were actually found:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/FindOpenSSL.cmake;hb=v3.0.1#l278 [^]

Try this patch (untested):

diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 340b417..a9295d2 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -275,9 +275,7 @@ function(from_hex HEX DEC)
 endfunction()
 
 if (OPENSSL_INCLUDE_DIR)
- if (_OPENSSL_VERSION)
- set(OPENSSL_VERSION "${_OPENSSL_VERSION}")
- elseif(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
+ if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
     file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
          REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
(0036896)
Brad King (manager)
2014-10-03 09:28

Moving to backlog awaiting feedback on patch in 0015075:0036591.
(0037666)
Brad King (manager)
2015-01-11 15:34

The change in 0015075:0036591 was also proposed here:

 https://github.com/Kitware/CMake/pull/138 [^]

and tested by the author. Applied:

 FindOpenSSL: Always extract version from detected header (0015075)
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=99b13820 [^]

(0038833)
Robert Maynard (manager)
2015-06-01 08:38

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2014-08-10 07:52 Cameron Garnham New Issue
2014-08-10 08:10 Cameron Garnham Note Added: 0036586
2014-08-10 08:13 Nils Gladitz Summary Unable to Override System OpenSSL with custom path (-DCMAKE_PREFIX_PATH=) => Wrong version found when overriding System OpenSSL with custom path (-DCMAKE_PREFIX_PATH=)
2014-08-10 08:13 Nils Gladitz Description Updated
2014-08-11 10:18 Brad King Note Added: 0036591
2014-08-11 10:18 Brad King Target Version => CMake 3.1
2014-10-03 09:28 Brad King Note Added: 0036896
2014-10-03 09:28 Brad King Status new => backlog
2014-10-03 09:28 Brad King Target Version CMake 3.1 =>
2015-01-11 15:34 Brad King Note Added: 0037666
2015-01-11 15:34 Brad King Assigned To => Brad King
2015-01-11 15:34 Brad King Status backlog => resolved
2015-01-11 15:34 Brad King Resolution open => fixed
2015-01-11 15:34 Brad King Fixed in Version => CMake 3.2
2015-01-11 15:34 Brad King Target Version => CMake 3.2
2015-06-01 08:38 Robert Maynard Note Added: 0038833
2015-06-01 08:38 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team