I'm trying to build a project which links to openssl Using CMake. I'm getting errors at the linking stage. One of the shared libraries cannot find certain openssl functions even tho that shared library is build successfully.
The portion of the error output that highlights the errors is:
[ 61%] Building C object CMakeFiles/uSockets.dir/_deps/usockets_content-src/src/quic.c.o
[ 66%] Building C object CMakeFiles/uSockets.dir/_deps/usockets_content-src/src/socket.c.o
[ 72%] Building C object CMakeFiles/uSockets.dir/_deps/usockets_content-src/src/udp.c.o
[ 77%] Linking C shared library libuSockets.so
[ 77%] Built target uSockets
[ 83%] Building CXX object CMakeFiles/client.dir/client_ws.cc.o
[ 88%] Linking CXX executable client
[ 88%] Built target client
[ 94%] Building CXX object CMakeFiles/server.dir/server_ws.cc.o
[100%] Linking CXX executable server
/usr/bin/ld: libuSockets.so: undefined reference to `us_internal_ssl_socket_context_on_long_timeout'
/usr/bin/ld: libuSockets.so: undefined reference to `us_internal_ssl_socket_get_native_handle'
/usr/bin/ld: libuSockets.so: undefined reference to `us_internal_create_child_ssl_socket_context'
/usr/bin/ld: libuSockets.so: undefined reference to `us_internal_ssl_socket_get_sni_userdata'
/usr/bin/ld: libuSockets.so: undefined reference to `us_internal_ssl_socket_context_connect_unix'
The full cmakelists.txt is at https://pastebin.com/TVrYhMVc
The full cmake output is at https://pastebin.com/1Bvd8GzQ
Any ideas what I'm missing?
include_directories. It was valid in old cmake. Use modern cmake patterns:target_link_libraries(your Taqrget PRIVATE OpenSSL::SSL OpenSSL::Crypto).pastebinespecially content is short. Just copy paste this into a question.Makeis invoked.