VTK/Tutorials/CMakeListsFile
From KitwarePublic
< VTK | Tutorials(Redirected from Typical CMakeLists.txt file)
To use CMake to generate your project, this is what the CMakeLists.txt file should look like:
CMakeLists.txt
cmake_minimum_required(VERSION 2.6) PROJECT(Test) FIND_PACKAGE(VTK REQUIRED) INCLUDE(${VTK_USE_FILE}) ADD_EXECUTABLE(Test Test.cpp) TARGET_LINK_LIBRARIES(Test vtkHybrid)
Here is a line by line break down of what is going on:
This will prevent annoying cmake warnings about "you must specifiy a minimum required version".
cmake_minimum_required(VERSION 2.6)
Name the project.
PROJECT(Test)
Tell cmake that this project needs to use VTK.
FIND_PACKAGE(VTK REQUIRED) INCLUDE(${VTK_USE_FILE})
Tell cmake we want to compile Test.cpp into a binary called Test.
ADD_EXECUTABLE(Test Test.cpp)
Tell cmake we need to link Test against vtkHybrid. This is the "catch all" VTK library. If you don't know what to link to, most of the time vtkHybrid will have what you need.
TARGET_LINK_LIBRARIES(Test vtkHybrid)

