views:

45

answers:

1

Hello,

I'm currently trying to link a CXX library that I've written to a VTK, a CMake made library - to end up creating a shared library that has my code's functionality and can resolve the symbols from VTK. I need the end result to be shared because I'd need to call the library up at runtime in Java.

Please feel free to ask any questions.

Cheers.

A: 

It sounds like you need to use target_link_libraries, so a minimal CMake block might look like,

find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
add_library(mylib SHARED sourcefile.cxx sourcefile2.cxx)
target_link_libraries(mylib vtkRendering)

This would add a shared library called mylib (libmylib.so on Linux), that links to vtkRendering (multiple libraries could be added here). Check out 'cmake --help-commands' for a full list of CMake commands.

Marcus D. Hanwell