Getting Started Coding/Cmake

From FarsightWiki
Jump to: navigation, search

Return to:

Getting Started

CMake

CMake is a the cross-platform, open-source build system which enables the user to link projects and add a new project to Farsight.

Sample CMakeLists.txt

cmake_minimum_required(VERSION 2.6)

project(MyNewProject)
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
     INCLUDE( ${ITK_USE_FILE} )
ELSE(ITK_FOUND)
     MESSAGE(FATAL_ERROR "Cannot build without ITK.  Please set ITK_DIR.")
ENDIF(ITK_FOUND)
                   
     ADD_LIBRARY(MyNewProjectLibrary MyNewProjectHeaderFile.h)
add_executable(MyNewProject MyNewProject.cxx)
target_link_libraries(MyNewProject MyNewProjectLibrary ITKCommon ITKIO)
SET_TARGET_PROPERTIES(MyNewProjectLibrary PROPERTIES LINKER_LANGUAGE C)
Personal tools