Reputation: 804
Here is a typical Cmakelist file with only one 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 is if I have test.cxx and CMakeLists.txt only. What do I do if I also have a test2.cxx source file (random class) and another test3.cxx source file? I want to keep test.cxx as my main, and the other as random classes, still using the vtk library.
Upvotes: 1
Views: 606
Reputation: 1405
add_executable
can be used to choose source files to use for this 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})
Upvotes: 1