I am desperatly struggling to compile the latest dcmtk release with the latest release of openSSL for Windows.
I have obtained the source code for openSSL 1.1.1i and compiled/installed it successfully (which was a struggle of its own, since the latest version of the recommended ActiveState perl did not work very well - everyone who reads this: Use Strawberry!).
Then I set the options in the CMAKE for dcmtk using cmake-gui:
- DCMTK_WITH_OPENSSL -> check
- WITH_OPENSSLINC -> <path to the root of my installed openSSL version>
I am quite sure though not absolutely sure that I have set the path correctly - more on this later.
When I am configuring the CMAKE-process, the following error occurs:
Code: Select all
Info: DCMTK OPENSSL support will be disabled: DCMTK requires OpenSSL version 1.0.1 or newer
What I have tried to solve it:
I found that the error message comes from a version check in 3rdparty.cmake, line 98:
Code: Select all
CHECK_CXX_SOURCE_COMPILES("extern \"C\" {\n#include <openssl/ssl.h>\n}\nint main(){\n#if OPENSSL_VERSION_NUMBER < 0x10001000L\n#error OpenSSL too old\n#endif\n}\n" OPENSSL_VERSION_CHECK)
Code: Select all
# define OPENSSL_VERSION_NUMBER 0x1010109fL
So I wanted to force CMAKE to build with openSSL and changed line 98 in 3rdparty.cmake like this:
Code: Select all
set(OPENSSL_VERSION_CHECK 1)
Code: Select all
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
Strangely, the VS editor shows these blocks "grayed out", i.e. it seems to obtain the correct version number from opensslv.h, Code navigation follows the symbol OPENSSL_VERSION_NUMBER to the correct header file in v1.1.1i. But the compiler seems to have different preprocessor symbols. Other errors refer to openssl functionality which is not surrounded by #ifdefs, e.g. X509_LOOKUP_add_dir is undefined (though code navigation also finds this in x509_vfy.h).
It is certainly not the best idea to bypass the version check in CMAKE, but to me the subsequent observations are noteworthy and tell me that I have appropriately set the path to the openSSL library, that the version is newer and should pass the check in CHECK_CXX_SOURCE_COMPILES, and that the generated makefiles for VC are pointing to the correct version of openssl.
Any hints will be much appreciated.