#
# CamiTK CMakeLists
#
# WARNING!
# CamiTK macros (component_extension, application_extension...) use GLOB to collect a 
# list of source files from your source tree, which means that if no CMakeLists.txt file changes 
# when a new source file is added or removed to your project then the generated build system 
# cannot know when to ask CMake to regenerate.
# => DO NOT FORGET to regenerate CMake in case you add/remove a source file to your project

# all CMake project names and variables should be in uppercase
project(CAMITK)

cmake_minimum_required(VERSION 2.6)

# Find Qt (Qt4 without Qt3 support!)
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
set (QT_USE_QT3SUPPORT OFF)

# Find VTK
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})

# Configure CamiTK
# update module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CAMITK_SOURCE_DIR}/cmake/modules)
# include CamiTK Internal Build environment
include(CamiTKInternalBuild)
# include CamiTK variables
include(CamiTKVariables)
# include CamiTK generic macros from CMAKE_MODULE_PATH directory
include(CamiTKMacros)
# include CamiTK log configuration
include(CamiTKLog)
# include CamiTK auto-documentation generation
include(CamiTKApiDoc)
# include CamiTK package generation
include(CamiTKPackaging)
# enables to specify which target to launch to MSVC
include(CreateLaunchers)

add_subdirectory(tools)
add_subdirectory(core)
add_subdirectory(components)
add_subdirectory(actions)
add_subdirectory(applications) # needs to be put at the end
add_subdirectory(cmake) # rules for cmake install

# For Microsoft Visual C++, sets the default application to imp for the "ALL_BUILD" project
# (i.e. launches imp when we you click on "Debug" or "Start Without Debugging" button on Visual)
# In addition, but not the least, sets the environment to the debug dll directory for VTK (and ITK)
#     to solve the dll incompatibility between debug and relase version of QVTK.dll and ITKCommon.dll
if ( MSVC )
	create_default_target_launcher(
		application-imp
		RUNTIME_LIBRARY_DIRS "%VTK_DIR%/bin/$(OutDir)" "%ITK_DIR%/bin/$(OutDir)"
	)		
endif( MSVC )
