c++ - How can I use CMake to link vtk library to multiple source file? -
here typical cmakelist file 1 source file:
cmake_minimum_required(version 2.8) project(test) find_package(vtk required) include(${vtk_use_file}) add_executable(test macosx_bundle test) if(vtk_libraries) target_link_libraries(test ${vtk_libraries}) else() target_link_libraries(test vtkhybrid vtkwidgets) endif() the above example if have test.cxx , cmakelists.txt only. do if have test2.cxx source file (random class) , test3.cxx source file? want keep test.cxx main, , other random classes, still using vtk library.
add_executable can used choose source files use project.
add_executable(test macosx_bundle test.cxx test2.cxx test42.cxx) same as
set(cxx_src_files test.cxx test2.cxx test42.cxx) add_executable(test macosx_bundle ${cxx_src_files})
Comments
Post a Comment