0
votes

I have built openssl on windows using nt.mak and no-shared flag to create static libraries. All my manually created VC++ projects link with static openssl libs and everything works fine.

Recently I am trying to use CMake to generate the VC++ project files. Compilation and linking works fine. But when I try to run the .exe, it starts looking for openssl dlls and fails.

The link instruction is within the source code like this:

#pragma comment(lib, "libeay32.lib")
#pragma comment(lib, "ssleay32.lib")

I have tried comparing the CMake generated project file with manually created project file, I am unable see the flag that would change thishavior.

The manually created project inks statically with openssl, CMake generated project links dynamically with openssl. How do I make CMake project file link statically with openssl?

1
Could you please share more information? Especially the code where you are linking to openssl. Did you try setting CMAKE_EXE_LINKER_FLAGS variable? - leodotcloud

1 Answers

0
votes

Solved. Turned out it was the order of lib directories. Once I ensured openssl static libraries are in the libpath first, the problem went away. The dependent libraries had their own openssl libs that was meddling with my build.