CMakeLists.txt 2.78 KB
Newer Older
pieper's avatar
pieper committed
1
PROJECT( Slicer3 )
2 3 4 5 6 7 8 9 10 11 12
CMAKE_MINIMUM_REQUIRED(VERSION 2.0)
MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY)

#-----------------------------------------------------------------------------
# Slicer version number.
SET(Slicer3_VERSION_MAJOR "3")
SET(Slicer3_VERSION_MINOR "0")
SET(Slicer3_VERSION_PATCH "0")
SET(Slicer3_VERSION "${Slicer3_VERSION_MAJOR}.${Slicer3_VERSION_MINOR}")
SET(Slicer3_VERSION_FULL "${Slicer3_VERSION}.${Slicer3_VERSION_PATCH}")

13 14 15 16
#-----------------------------------------------------------------------------
# Build shared lib by default
OPTION(BUILD_SHARED_LIBS "Build Slicer3 with shared libraries." ON)

pieper's avatar
pieper committed
17 18 19 20 21

#
# Top level slicer3 configurations
#

22
SET (LIBRARY_OUTPUT_PATH ${Slicer3_BINARY_DIR}/bin/ 
pieper's avatar
pieper committed
23 24 25 26 27 28 29 30 31 32
        CACHE PATH 
        "Single output directory for building all libraries." 
        FORCE)
SET (EXECUTABLE_OUTPUT_PATH ${Slicer3_BINARY_DIR}/bin/ 
        CACHE PATH 
        "Single output directory for building all executables." 
        FORCE)

# Add the testing directories

33 34
OPTION(BUILD_TESTING "Test the project" ON)
SET(Slicer3_BUILD_TESTING ${BUILD_TESTING})
pieper's avatar
pieper committed
35 36 37
IF(Slicer3_BUILD_TESTING)
    ENABLE_TESTING()
    INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
38
    MARK_AS_ADVANCED(TCL_TCLSH DART_ROOT)
pieper's avatar
pieper committed
39 40
ENDIF(Slicer3_BUILD_TESTING)

41 42 43 44 45 46 47
#
# Libs
# - ITK
# - KWWidgets (pulls in VTK)
#

## ITK
48
FIND_PACKAGE(ITK REQUIRED)
49 50 51 52 53 54 55 56
IF (NOT ITK_FOUND)
  MESSAGE (FATAL_ERROR "Need ITK to build")
ENDIF (NOT ITK_FOUND)

INCLUDE(${ITK_USE_FILE})


## KWWidgets
57
FIND_PACKAGE(KWWidgets REQUIRED)
58 59 60 61 62 63
IF (NOT KWWidgets_FOUND)
  MESSAGE (FATAL_ERROR "Need KWWidgets to build")
ENDIF (NOT KWWidgets_FOUND)

INCLUDE(${KWWidgets_USE_FILE})

barre's avatar
barre committed
64 65 66 67 68
# Generate the default setup paths scripts.
# Generate some useful scripts that can be used to setup various environment 
# variables and launch the executable properly against external packages.

INCLUDE("${KWWidgets_CMAKE_DIR}/KWWidgetsPathsMacros.cmake")
barre's avatar
barre committed
69
KWWidgets_GENERATE_SETUP_PATHS_SCRIPTS(
barre's avatar
barre committed
70 71 72 73 74 75 76 77 78 79 80
  "${EXECUTABLE_OUTPUT_PATH}" "Slicer3SetupPaths")

# VTK 5.0 does not have VTK_CMAKE_DIR
# Alternatively you could use KWWidget's wrapping, which encapsulate
# the differences between various VTK versions:
#  INCLUDE("${KWWidgets_CMAKE_DIR}/KWWidgetsWrappingMacros.cmake")
#  KWWidgets_WRAP_TCL(${LIB_NAME} LIB_TCL_SRCS "${LIB_SRCS}" "")

IF(NOT VTK_CMAKE_DIR)
  SET(VTK_CMAKE_DIR "${VTK_SOURCE_DIR}/CMake")
ENDIF(NOT VTK_CMAKE_DIR)
81 82 83
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE("${VTK_CMAKE_DIR}/vtkWrapTcl.cmake")

84
# TODO
85 86
# VTK_WRAP_TCL3(${LIB_NAME} LIB_TCL_SRCS ${LIB_SRCS} "")

pieper's avatar
pieper committed
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103

#
# Subdirectories
#

SUBDIRS(
    Libs
    Base
    Modules
    Applications
)


IF (Slicer3_BUILD_TESTING)
    SUBDIRS( Testing )
ENDIF (Slicer3_BUILD_TESTING)

104 105 106
# include a test for endianness (used to be done by default)
INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)