Commit d0d4ebe5 authored by jcfr's avatar jcfr
Browse files

BUG: Add FindCTK.cmake to repository

Doing so will avoid to download it directly from github

git-svn-id: http://svn.slicer.org/Slicer4/trunk@15226 3bd1e089-480b-0410-8dfb-8563597acbee
parent a9030990
###########################################################################
#
# Library: CTK
#
# Copyright (c) Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.commontk.org/LICENSE
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
###########################################################################
# - Find a CTK installation or build tree.
# The following variables are set if CTK is found. If CTK is not
# found, CTK_FOUND is set to false.
# CTK_FOUND - Set to true when CTK is found.
# CTK_USE_FILE - CMake file to use CTK.
# CTK_MAJOR_VERSION - The CTK major version number.
# CTK_MINOR_VERSION - The CTK minor version number
# (odd non-release).
# CTK_BUILD_VERSION - The CTK patch level
# (meaningless for odd minor).
# CTK_INCLUDE_DIRS - Include directories for CTK
# CTK_LIBRARY_DIRS - Link directories for CTK libraries
# CTK_LIBRARIES - List of libraries
#
# The following cache entries must be set by the user to locate VTK:
# CTK_DIR - The directory containing CTKConfig.cmake.
# This is either the root of the build tree,
# or the lib/ctk directory. This is the
# only cache entry.
#
# Assume not found.
SET(CTK_FOUND 0)
# Construct consitent error messages for use below.
SET(CTK_DIR_MESSAGE "CTK not found. Set the CTK_DIR cmake cache entry to the directory containing CTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/ctk for an installation.")
# Use the Config mode of the find_package() command to find CTKConfig.
# If this succeeds (possibly because CTK_DIR is already set), the
# command will have already loaded CTKConfig.cmake and set CTK_FOUND.
IF(NOT CTK_FOUND)
FIND_PACKAGE(CTK QUIET NO_MODULE)
ENDIF()
#-----------------------------------------------------------------------------
IF(NOT CTK_FOUND)
# CTK not found, explain to the user how to specify its location.
IF(CTK_FIND_REQUIRED)
MESSAGE(FATAL_ERROR ${CTK_DIR_MESSAGE})
ELSE(CTK_FIND_REQUIRED)
IF(NOT CTK_FIND_QUIETLY)
MESSAGE(STATUS ${CTK_DIR_MESSAGE})
ENDIF(NOT CTK_FIND_QUIETLY)
ENDIF(CTK_FIND_REQUIRED)
ENDIF()
......@@ -260,29 +260,6 @@ SET(Slicer_INSTALL_MODULES_SHARE_DIR "${Slicer_INSTALL_SHARE_DIR}/Modules")
SET(Slicer_HOME "${Slicer_BINARY_DIR}")
#-----------------------------------------------------------------------------
# Convenient macro allowing to download a file
#------------------------------------------------------------------------------
MACRO(downloadFile url dest)
IF(NOT EXISTS ${dest})
FILE(DOWNLOAD ${url} ${dest} STATUS status)
LIST(GET status 0 error_code)
LIST(GET status 1 error_msg)
IF(error_code)
MESSAGE(FATAL_ERROR "error: Failed to download ${url} - ${error_msg}")
ENDIF()
ELSE()
# Make sure the file is not empty
FILE(READ ${dest} dest_content LIMIT 4)
STRING(LENGTH "${dest_content}" dest_length)
IF(NOT "${dest_length}" EQUAL 4)
FILE(REMOVE ${dest})
downloadFile(${url} ${dest})
ENDIF()
ENDIF()
ENDMACRO()
#-----------------------------------------------------------------------------
# Disable the warnings that DevStudio 2005 emits wrt to sprintf, strcpu, etc.
#
......@@ -468,9 +445,6 @@ ENDIF()
SET(git_repo http://github.com/commontk/CTK/raw/master/)
IF(Slicer_USE_QT)
SET(file Utilities/CMake/FindCTK.cmake)
downloadFile(${git_repo}/${file} ${Slicer_BINARY_DIR}/CMake/FindCTK.cmake)
FIND_PACKAGE(CTK REQUIRED)
INCLUDE(${CTK_USE_FILE})
# Update CMake module path
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment