[CMake] Separating build from source
motes motes
mort.motes at gmail.com
Sat May 8 19:41:43 EDT 2010
I am trying to build an application which use the itk library based on
the following structure:
code/
code/src
code/src/MyItkProject
code/build
code/build/release
code/build/debug
CMakeLists.txt
I have located my CMakeLists.txt file in the 'code' dir where I
specify the necessary includes. I have my main.cpp file in:
code/src/MyItkProject/main.cpp
I have extracted and build the itk library in another location and set
up the above CMakeLists.txt file to ask the user to specify the build
dir with:
cmake_minimum_required(VERSION 2.6)
PROJECT(MyItkProject)
FIND_PATH(PROJECT_HOME REQUIRED)
FIND_PATH(ITK_DIR REQUIRED)
# Find ITK.
FIND_PACKAGE(ITK REQUIRED)
IF( ITK_FOUND )
INCLUDE( ${ITK_USE_FILE} )
ELSE( ITK_FOUND )
MESSAGE( FATAL_ERROR "Cannot build without ITK. Please set ITK_DIR." )
ENDIF( ITK_FOUND )
I then run ccmake from the code/build/release dir like:
code/build/release$ ccmake ../../
After specifying the necessary paths (and Release as build type) I run
'configure' followed by 'generate' but get the error:
CMake Error in CMakeLists.txt
Cannot find source file "main.cpp". Tried extensions ....
Do I need to add another CMakeLists.txt file in the dir
code/src/MyItkProject which specifies the main.cpp file?
More information about the CMake
mailing list