I'm currently trying to lin开发者_JAVA技巧k 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.
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.
精彩评论