X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=CMakeLists.txt;h=4433fd5f6c2732a7cddf18f4281ebedb8f4d5143;hb=d1cf86f331e421ff841ac1bb7323369751a648b9;hp=3d35e90af5533877fca1aa3d55ed1b9466b84e78;hpb=eb46f178c8cd7efca6bc149bcd95c41a4a3704f2;p=gdcm.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d35e90a..4433fd5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,24 +1,17 @@ PROJECT(GDCM) CMAKE_MINIMUM_REQUIRED(VERSION 1.8) -# The GDCM version number. +#----------------------------------------------------------------------------- +# GDCM version number, usefull for packaging and doxygen doc: SET(GDCM_VERSION_MAJOR 0) SET(GDCM_VERSION_MINOR 4) SET(GDCM_VERSION_PATCH 0) SET(GDCM_VERSION "${GDCM_VERSION_MAJOR}.${GDCM_VERSION_MINOR}") SET(GDCM_VERSION_FULL "${GDCM_VERSION}.${GDCM_VERSION_PATCH}") -#----------------------------------------------------------------------------- -# Output directories. -SET (LIBRARY_OUTPUT_PATH ${GDCM_SOURCE_DIR}/lib CACHE PATH "Single output directory for building all libraries.") -SET (EXECUTABLE_OUTPUT_PATH ${GDCM_SOURCE_DIR}/lib CACHE PATH "Single output directory for building all executables.") -MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH) -SET(GDCM_LIBRARY_PATH "${LIBRARY_OUTPUT_PATH}") -SET(GDCM_EXECUTABLE_PATH "${EXECUTABLE_OUTPUT_PATH}") - #----------------------------------------------------------------------------- # datadir in CMake: -SET(GDCM_DATA_DIR "/share/gdcm" CACHE STRING +SET(GDCM_DATA_DIR "/share/gdcm/" CACHE INTERNAL "Install location for data (relative to prefix).") MARK_AS_ADVANCED(GDCM_DATA_DIR) @@ -27,51 +20,109 @@ MARK_AS_ADVANCED(GDCM_DATA_DIR) OPTION(BUILD_SHARED_LIBS "Build GDCM with shared libraries." ON) SET(GDCM_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) -#INCLUDE_DIRECTORIES( +SET(CMAKE_CONFIGURATION_TYPES + Debug + Release +) +SET(CMAKE_BUILD_TYPE_INIT Debug) + +# Deals with problem on SunOS: +# ostrstream vs. ostringstream + +#SET(GDCM_NO_ANSI_STRING_STREAM +# ${CMAKE_NO_ANSI_STRING_STREAM} #) +#CONFIGURE_FILE(${GDCM_SOURCE_DIR}/src/gdcmCommon.h.in +# ${GDCM_BINARY_DIR}/src/gdcmCommon.h @ONLY IMMEDIATE) + +#----------------------------------------------------------------------------- +# Output directories. +#Put all stuff in one single dir for Win32, otherwise dll are a pain: +IF(WIN32 AND GDCM_BUILD_SHARED_LIBS) + SET(OUTPUT_LIB_DIR ${GDCM_SOURCE_DIR}/bin) +ELSE(WIN32 AND GDCM_BUILD_SHARED_LIBS) + SET(OUTPUT_LIB_DIR ${GDCM_SOURCE_DIR}/lib) +ENDIF(WIN32 AND GDCM_BUILD_SHARED_LIBS) + +SET (EXECUTABLE_OUTPUT_PATH ${GDCM_SOURCE_DIR}/bin CACHE PATH "Single output directory for building all executables.") +SET (LIBRARY_OUTPUT_PATH ${OUTPUT_LIB_DIR} CACHE PATH "Single output directory for building all libraries.") +MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH) +SET(GDCM_LIBRARY_PATH "${LIBRARY_OUTPUT_PATH}") +SET(GDCM_EXECUTABLE_PATH "${EXECUTABLE_OUTPUT_PATH}") #----------------------------------------------------------------------------- # Build directory on which many applications depend SUBDIRS( src - Test Dicts + Test ) #----------------------------------------------------------------------------- -# Search VTK -FIND_PACKAGE(VTK) -# If vtk found -IF(VTK_FOUND) - OPTION(GDCM_VTK "Build VTK-GDCM Lib." OFF) - IF(GDCM_VTK) +OPTION(GDCM_VTK "Build VTK-GDCM Lib." OFF) +IF(GDCM_VTK) + # Search VTK + FIND_PACKAGE(VTK) + # If vtk found + IF(VTK_FOUND) INCLUDE(${VTK_USE_FILE}) SUBDIRS(vtk) - ENDIF(GDCM_VTK) -ENDIF(VTK_FOUND) + ENDIF(VTK_FOUND) +ENDIF(GDCM_VTK) #----------------------------------------------------------------------------- -# Search Python libs: -FIND_PACKAGE(PythonLibs) -# If PythonLibs found -IF(PYTHON_LIBRARY) - OPTION(GDCM_WRAP_PYTHON "Wrap GDCM classes into the Python language." OFF) - #if wrapping enable - IF(GDCM_WRAP_PYTHON) +OPTION(GDCM_WRAP_PYTHON "Wrap GDCM classes into the Python language." OFF) +#if wrapping enable +IF(GDCM_WRAP_PYTHON) + # Search Python libs: + FIND_PACKAGE(PythonLibs) + # If PythonLibs found + IF(PYTHON_LIBRARY) SUBDIRS(gdcmPython) - ENDIF(GDCM_WRAP_PYTHON) -ENDIF(PYTHON_LIBRARY) + ENDIF(PYTHON_LIBRARY) +ENDIF(GDCM_WRAP_PYTHON) #----------------------------------------------------------------------------- -# Search Doxygen: -FIND_PACKAGE(Doxygen) -IF(DOXYGEN) - OPTION(GDCM_DOXYGEN "Build source documentation using doxygen." OFF) - # if doxygen enable - IF(GDCM_DOXYGEN) +OPTION(GDCM_DOXYGEN "Build source documentation using doxygen." OFF) +# if doxygen enable +IF(GDCM_DOXYGEN) + # Search Doxygen: + FIND_PACKAGE(Doxygen) + IF(DOXYGEN) SUBDIRS(Doc) - ENDIF(GDCM_DOXYGEN) -ENDIF(DOXYGEN) + ENDIF(DOXYGEN) +ENDIF(GDCM_DOXYGEN) + +#----------------------------------------------------------------------------- +# Configure files with settings for use by the build. +# for third party to access gdcm through cmake +# to be rewritten to include only the necessary + +CONFIGURE_FILE( + ${GDCM_SOURCE_DIR}/gdcmConfig.cmake.in + ${GDCM_BINARY_DIR}/gdcmConfig.cmake @ONLY IMMEDIATE + ) + +# Export uor build settings and library +# dependencies for the use by the user projects. +INCLUDE( + ${CMAKE_ROOT}/Modules/CMakeExportBuildSettings.cmake) + +CMAKE_EXPORT_BUILD_SETTINGS( + ${GDCM_BINARY_DIR}/gdcmBuildSettings.cmake + ) + +EXPORT_LIBRARY_DEPENDENCIES( + ${GDCM_BINARY_DIR}/gdcmLibraryDepends.cmake + ) + +# Intall the âckaging files for use by FIND_PACKAGE(GDCM) in user projects. +INSTALL_FILES(/lin/gdcm FILES + ${GDCM_SOURCE_DIR}/gdcmUse.cmake + ${GDCM_BINARY_DIR}/gdcmConfig.cmake + ${GDCM_BINARY_DIR}/gdcmBuildSettings.cmake + ${GDCM_BINARY_DIR}/gdcmLibraryDepends.cmake + ) #----------------------------------------------------------------------------- # Copy / paste from old m4 script: @@ -85,7 +136,7 @@ ENDIF(DOXYGEN) # README \ # TODO \ # gdcm.spec \ -# gdcm.dsw +# gdcm.dsw #release: # $(MAKE) dist distdir=$(PACKAGE)-$(VERSION)