Commit 114526a2 authored by jcfr's avatar jcfr

COMP: Ensure PreventDirWithSpaces CMake variables is passed to inner project.

This commit ensures that spaces can be used in either source or build
directory when configuring Slicer inner project. This is done by passing
down the variable ${PROJECT_NAME}_SKIP_DIR_WITH_SPACES_CHECK

This commit also documents and simplifies usage of
"PreventDirWithSpaces" CMake module.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23360 3bd1e089-480b-0410-8dfb-8563597acbee
parent 603f5f04
#
# This function will prevent building the project from a source or build directory having spaces
#
# To allow directory with spaces, the project can be configured with:
#
# -D<PROJECT_NAME>_SKIP_DIR_WITH_SPACES_CHECK:BOOL=TRUE
#
function(AssureNoSpacesForSourceOrBuildDir)
function(_check_path path description)
......@@ -17,7 +22,10 @@ function(AssureNoSpacesForSourceOrBuildDir)
message(FATAL_ERROR
"The current ${description} directory contains spaces:\n"
" ${real_path}\n"
"This is not supported.\n"
"Building the project from a source or build directory having spaces is NOT recommended or tested !\n"
""
"To ignore this error, reconfigure with the following option:\n"
" -D${PROJECT_NAME}_SKIP_DIR_WITH_SPACES_CHECK:BOOL=TRUE\n"
)
endif()
......@@ -28,4 +36,9 @@ function(AssureNoSpacesForSourceOrBuildDir)
endfunction()
AssureNoSpacesForSourceOrBuildDir()
if(NOT DEFINED ${PROJECT_NAME}_SKIP_DIR_WITH_SPACES_CHECK)
set(${PROJECT_NAME}_SKIP_DIR_WITH_SPACES_CHECK FALSE)
endif()
if(NOT ${PROJECT_NAME}_SKIP_DIR_WITH_SPACES_CHECK)
AssureNoSpacesForSourceOrBuildDir()
endif()
......@@ -75,13 +75,8 @@ if(WIN32)
endif()
include(PreventInSourceBuilds)
include(PreventInBuildInstalls)
if(NOT DEFINED Slicer_SKIP_DIR_WITH_SPACES_CHECK)
set(Slicer_SKIP_DIR_WITH_SPACES_CHECK FALSE)
endif()
if(NOT Slicer_SKIP_DIR_WITH_SPACES_CHECK)
include(PreventDirWithSpaces)
endif()
include(PreventDirWithSpaces)
mark_as_superbuild(${PROJECT_NAME}_SKIP_DIR_WITH_SPACES_CHECK:BOOL)
#-----------------------------------------------------------------------------
# Overwrite default options
......
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