[CMake] Undefined reference

Matt Williams lists at milliams.com
Thu Nov 3 10:22:35 EDT 2011


On 3 November 2011 15:12, Mauricio Klein <mauricio.klein.msk at gmail.com> wrote:
> Hello guys!
> I'm new in CMake world, and i'm trying to compile a daemon developed a log
> time ago.
> I can compile all my codes without problems, but in the linkage step, i
> receive a lot of errors about undefined reference to OpenSSL functions (yes,
> my code uses OpenSSL).
> In my own (and ugly :P) Makefile, i use "-lssl" flag in g++ compile line.
> My question is: how can i pass this flag in CMake.

Hi there, maybe this is what you want:

find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})
add_executable(my_daemon ${source_files})
target_link_libraries(my_daemon ${OPENSSL_LIBRARIES})

where ${source_files} is a list of your source files created by a set() call.

-- 
Matt Williams
http://milliams.com


More information about the CMake mailing list