Permalink
Browse files

COMP: DoubleConvert needs to be included

In order to build BRAINSTools, the External_DoubleConvert.cmake needs
to be built prior to building the BRAINSTools.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21790 3bd1e089-480b-0410-8dfb-8563597acbee
  • Loading branch information...
1 parent d30d305 commit 1daf264428da4556b0a6c11cc898aff0032f814f hjohnson committed Mar 12, 2013
Showing with 102 additions and 1 deletion.
  1. +1 −1 SuperBuild.cmake
  2. +101 −0 SuperBuild/External_DoubleConvert.cmake
View
@@ -112,7 +112,7 @@ if(Slicer_BUILD_CLI_SUPPORT)
endif()
if(Slicer_BUILD_BRAINSTOOLS)
- list(APPEND Slicer_DEPENDENCIES BRAINSTools)
+ list(APPEND Slicer_DEPENDENCIES BRAINSTools DoubleConvert)
endif()
if(Slicer_BUILD_EMSegment)
@@ -0,0 +1,101 @@
+
+# Make sure this file is included only once by creating globally unique varibles
+# based on the name of this included file.
+get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE)
+if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED)
+ return()
+endif()
+set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1)
+
+## External_${extProjName}.cmake files can be recurisvely included,
+## and cmake variables are global, so when including sub projects it
+## is important make the extProjName and proj variables
+## appear to stay constant in one of these files.
+## Store global variables before overwriting (then restore at end of this file.)
+#ProjectDependancyPush(CACHED_extProjName ${extProjName})
+#ProjectDependancyPush(CACHED_proj ${proj})
+
+# Make sure that the ExtProjName/IntProjName variables are unique globally
+# even if other External_${ExtProjName}.cmake files are sourced by
+# SlicerMacroCheckExternalProjectDependency
+set(extProjName DoubleConvert) #The find_package known name
+set(proj DoubleConvert) #This local name
+
+#if(${USE_SYSTEM_${extProjName}})
+# unset(${extProjName}_DIR CACHE)
+#endif()
+
+# Sanity checks
+if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR})
+ message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})")
+endif()
+
+# Set dependency list
+set(${proj}_DEPENDENCIES "")
+if(${PROJECT_NAME}_BUILD_DICOM_SUPPORT)
+ list(APPEND ${proj}_DEPENDENCIES DCMTK)
+endif()
+
+# Include dependent projects if any
+SlicerMacroCheckExternalProjectDependency(${proj})
+
+if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) )
+ #message(STATUS "${__indent}Adding project ${proj}")
+
+ # Set CMake OSX variable to pass down the external project
+ set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
+ if(APPLE)
+ list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS
+ -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
+ -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
+ -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET})
+ endif()
+
+ ### --- Project specific additions here
+
+ if(NOT DEFINED git_protocol)
+ set(git_protocol "git")
+ endif()
+
+ set(${proj}_CMAKE_OPTIONS
+ -DBUILD_TESTING:BOOL=OFF
+ -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/${proj}-install
+ )
+ ### --- End Project specific additions
+ set(${proj}_REPOSITORY ${git_protocol}://github.com/BRAINSia/double-conversion.git)
+ set(${proj}_GIT_TAG 9014759697ed334753a8334e09ec8c01f9c53830)
+ ExternalProject_Add(${proj}
+ GIT_REPOSITORY ${${proj}_REPOSITORY}
+ GIT_TAG ${${proj}_GIT_TAG}
+ SOURCE_DIR ${proj}
+ BINARY_DIR ${proj}-build
+ ${cmakeversion_external_update} "${cmakeversion_external_update_value}"
+ CMAKE_GENERATOR ${gen}
+ CMAKE_ARGS
+ -Wno-dev
+ --no-warn-unused-cli
+ ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS}
+ ${COMMON_EXTERNAL_PROJECT_ARGS}
+ ${${proj}_CMAKE_OPTIONS}
+## We really do want to install in order to limit # of include paths INSTALL_COMMAND ""
+ DEPENDS
+ ${${proj}_DEPENDENCIES}
+ )
+ set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-install/lib/cmake/ITK-4.4)
+else()
+ if(${USE_SYSTEM_${extProjName}})
+ find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED)
+ if(NOT ${extProjName}_DIR)
+ message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR")
+ endif()
+ message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}")
+ endif()
+ # The project is provided using ${extProjName}_DIR, nevertheless since other
+ # project may depend on ${extProjName}, let's add an 'empty' one
+ SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}")
+endif()
+
+list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH)
+
+#ProjectDependancyPop(CACHED_extProjName extProjName)
+#ProjectDependancyPop(CACHED_proj proj)

0 comments on commit 1daf264

Please sign in to comment.