Commit 900fc739 authored by jcfr's avatar jcfr

ENH: cmake: Check package availability when building against system python

This commit implements the check looking for required python modules
when building against system version of python.

For example, assuming that all required packages are installed in
a python virtual environment named "slicer":

$ cmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/path/to/bin/qmake \
  -DCMAKE_BUILD_TYPE:STRING=Release \
  -DSlicer_USE_SYSTEM_python:BOOL=1 \
  ../Slicer

would output text like this one:

[...]
-- SuperBuild -         python-pyparsing => Requires python[INCLUDED],
-- SuperBuild -         python-pyparsing[OK] (SYSTEM)
-- PYPARSING_PATH: /home/jcfr/.virtualenvs/slicer/local/lib/python2.7/site-packages
-- PYPARSING_VERSION: 2.2.0
-- SuperBuild -       python-packaging[OK] (SYSTEM)
-- PACKAGING_PATH: /home/jcfr/.virtualenvs/slicer/local/lib/python2.7/site-packages/packaging
-- PACKAGING_VERSION: 16.8
-- SuperBuild -       python-six => Requires python[INCLUDED],
-- SuperBuild -       python-six[OK] (SYSTEM)
-- SIX_PATH: /home/jcfr/.virtualenvs/slicer/local/lib/python2.7/site-packages
-- SIX_VERSION: 1.10.0
[...]

git-svn-id: http://svn.slicer.org/Slicer4/trunk@26055 3bd1e089-480b-0410-8dfb-8563597acbee
parent 389b8fbe
################################################################################
#
# Program: 3D Slicer
#
# Copyright (c) Kitware Inc.
#
# See COPYRIGHT.txt
# or http://www.slicer.org/copyright/copyright.txt for details.
#
# 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.
#
# This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
# and was partially funded by NIH grant 1U24CA194354-01
#
################################################################################
#
#.rst:
# ExternalProjectDependencyForPython
# ----------------------------------
#
# This module provides functions indended to be used in ``External_*.cmake`` files.
#
# .. command:: ExternalProject_FindPythonPackage
#
# ExternalProject_FindPythonPackage(
# MODULE_NAME <python-module-name>
# [VERSION_PROPERTY <version-property>]
# [PYTHON_EXECUTABLE /path/to/python-interpreter]
# [OUTPUT_VAR_PREFIX <output-var-prefix>]
# )
#
# This function tries to import ``<python-module-name>`` module.
#
# By default, it displays corresponding module path and version and set variables
# ``<python-module-name>_PATH`` and ``<python-module-name>_VERSION``.
#
# The options are:
#
# ``MODULE_NAME <python-module-name>``
# Name of the python module to try to import using ``/path/to/python-interpreter -c "import <python-module-name>"``.
#
# ``REQUIRED``
# Report a fatal error if module can not be imported.
#
# ``QUIET``
# Do not display path and version.
#
# ``VERSION_PROPERTY <version-property>``
# Name of the version property to query. It defaults to ``<python-module-name>.__version__``.
#
# ``NO_VERSION_PROPERTY``
# If specified, do not attempt to extract version information and set output variable.
#
# ``PYTHON_EXECUTABLE /path/to/python-interpreter``
# Path of the python executable to search module with. It defaults to value
# of ``PYTHON_EXECUTABLE`` variable set in the calling scope.
#
# ``OUTPUT_VAR_PREFIX <output-var-prefix>``
# Specify the prefix of output variables ``<output-var-prefix>_PATH`` and ``<output-var-prefix>_VERSION``.
# It defaults to upercase value of ``<python-module-name>``.
#
function(ExternalProject_FindPythonPackage)
set(options REQUIRED QUIET NO_VERSION_PROPERTY)
set(oneValueArgs MODULE_NAME VERSION_PROPERTY PYTHON_EXECUTABLE OUTPUT_VAR_PREFIX)
set(multiValueArgs )
cmake_parse_arguments(MY "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# Sanity checks
if(NOT DEFINED MY_MODULE_NAME)
message(FATAL_ERROR "Parameter MODULE_NAME is not specified !")
endif()
# Defaults
if(NOT DEFINED MY_VERSION_PROPERTY)
set(MY_VERSION_PROPERTY "__version__")
endif()
if(NOT DEFINED MY_OUTPUT_VAR_PREFIX)
string(TOUPPER "${MY_MODULE_NAME}" MY_OUTPUT_VAR_PREFIX)
endif()
# Python interpreter
if(NOT DEFINED MY_PYTHON_EXECUTABLE)
if(NOT DEFINED PYTHON_EXECUTABLE)
find_package(PythonInterp REQUIRED)
endif()
set(MY_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
if(NOT EXISTS "${MY_PYTHON_EXECUTABLE}")
if(MY_REQUIRED)
message(FATAL_ERROR "Could not find Python interpreter for required dependency ${MY_MODULE_NAME}. Path '${MY_PYTHON_EXECUTABLE}' corresponds to a nonexistent file.")
else()
message(STATUS "Could not find ${MY_MODULE_NAME} because no Python interpreter was found")
return()
endif()
endif()
endif()
# Check if module can be imported
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import ${MY_MODULE_NAME}"
RESULT_VARIABLE _process_status
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT _process_status EQUAL 0)
if(MY_REQUIRED)
message(FATAL_ERROR "Could not import module for required dependency '${MY_MODULE_NAME}' using '${MY_PYTHON_EXECUTABLE}' interpreter.")
else()
message(STATUS "Could not find ${MY_MODULE_NAME} using '${MY_PYTHON_EXECUTABLE}' interpreter.")
return()
endif()
endif()
# Get path
execute_process(
COMMAND
${PYTHON_EXECUTABLE} -c
"import ${MY_MODULE_NAME}; print(${MY_MODULE_NAME}.__file__)"
RESULT_VARIABLE _process_status
OUTPUT_VARIABLE _process_output
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT _process_status EQUAL 0)
message(FATAL_ERROR "Could not get module '${MY_MODULE_NAME}' path using '${MY_MODULE_NAME}.__file__'.")
endif()
set(_path "${_process_output}")
string(STRIP ${_path} _path)
get_filename_component(_path ${_path} DIRECTORY)
# Get version
if(NOT MY_NO_VERSION_PROPERTY)
execute_process(
COMMAND
${PYTHON_EXECUTABLE} -c
"import ${MY_MODULE_NAME}; print(${MY_MODULE_NAME}.${MY_VERSION_PROPERTY})"
RESULT_VARIABLE _process_status
OUTPUT_VARIABLE _process_output
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT _process_status EQUAL 0)
message(FATAL_ERROR "Could not get module '${MY_MODULE_NAME}' version using '${MY_MODULE_NAME}.${MY_VERSION_PROPERTY}'.")
endif()
set(_version "${_process_output}")
string(STRIP ${_version} _version)
endif()
# Path
if(NOT MY_QUIET)
message(STATUS "${MY_OUTPUT_VAR_PREFIX}_PATH: ${_path}")
endif()
set(${MY_OUTPUT_VAR_PREFIX}_PATH "${_path}" PARENT_SCOPE)
# Version
if(NOT MY_NO_VERSION_PROPERTY)
if(NOT MY_QUIET)
message(STATUS "${MY_OUTPUT_VAR_PREFIX}_VERSION: ${_version}")
endif()
set(${MY_OUTPUT_VAR_PREFIX}_VERSION "${_version}" PARENT_SCOPE)
endif()
endfunction()
......@@ -234,6 +234,7 @@ include(CMakeParseArguments)
include(ctkMacroCompilePythonScript)
include(ctkMacroWrapPythonQt)
include(ExternalProjectDependency)
include(ExternalProjectDependencyForPython)
include(SlicerMacroParseArguments)
include(SlicerMacroCheckExternalProjectDependency)
include(SlicerMacroEmptyExternalProject)
......
......@@ -16,6 +16,7 @@ endforeach()
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
include(ExternalProject)
include(ExternalProjectDependency)
include(ExternalProjectDependencyForPython)
include(ExternalProjectGenerateProjectDescription)
#-----------------------------------------------------------------------------
......
......@@ -4,15 +4,18 @@ set(proj NUMPY)
# Set dependency list
set(${proj}_DEPENDENCIES python python-setuptools python-nose)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if numpy is available
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_NUMPY)
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_NUMPY ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
ExternalProject_FindPythonPackage(
MODULE_NAME "numpy"
REQUIRED
)
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_NUMPY)
......
......@@ -3,16 +3,21 @@ set(proj python-GitPython)
# Set dependency list
set(${proj}_DEPENDENCIES python python-setuptools python-gitdb)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if <proj> is available
ExternalProject_FindPythonPackage(
MODULE_NAME "git"
REQUIRED
)
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
......
......@@ -3,15 +3,19 @@ set(proj python-PyGithub)
# Set dependency list
set(${proj}_DEPENDENCIES python python-setuptools)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if <proj> is available
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
ExternalProject_FindPythonPackage(
MODULE_NAME "github"
NO_VERSION_PROPERTY
REQUIRED
)
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
......
......@@ -3,15 +3,18 @@ set(proj python-appdirs)
# Set dependency list
set(${proj}_DEPENDENCIES python)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if <proj> is available
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
ExternalProject_FindPythonPackage(
MODULE_NAME "appdirs"
REQUIRED
)
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
......
......@@ -3,15 +3,19 @@ set(proj python-chardet)
# Set dependency list
set(${proj}_DEPENDENCIES python python-setuptools)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if <proj> is available
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
ExternalProject_FindPythonPackage(
MODULE_NAME "chardet"
REQUIRED
)
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
......
......@@ -3,15 +3,18 @@ set(proj python-couchdb)
# Set dependency list
set(${proj}_DEPENDENCIES python python-setuptools)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if <proj> is available
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
ExternalProject_FindPythonPackage(
MODULE_NAME "couchdb"
REQUIRED
)
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
......
......@@ -3,15 +3,18 @@ set(proj python-gitdb)
# Set dependency list
set(${proj}_DEPENDENCIES python python-setuptools python-smmap)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if <proj> is available
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
ExternalProject_FindPythonPackage(
MODULE_NAME "gitdb"
REQUIRED
)
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
......
......@@ -3,15 +3,18 @@ set(proj python-nose)
# Set dependency list
set(${proj}_DEPENDENCIES python python-setuptools)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if <proj> is available
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
ExternalProject_FindPythonPackage(
MODULE_NAME "nose"
REQUIRED
)
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
......
......@@ -3,15 +3,18 @@ set(proj python-packaging)
# Set dependency list
set(${proj}_DEPENDENCIES python python-pyparsing)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if <proj> is available
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
ExternalProject_FindPythonPackage(
MODULE_NAME "packaging"
REQUIRED
)
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
......
......@@ -3,15 +3,18 @@ set(proj python-pip)
# Set dependency list
set(${proj}_DEPENDENCIES python python-wheel)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if <proj> is available
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
ExternalProject_FindPythonPackage(
MODULE_NAME "pip"
REQUIRED
)
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
......
......@@ -3,15 +3,18 @@ set(proj python-pydicom)
# Set dependency list
set(${proj}_DEPENDENCIES python python-setuptools)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if <proj> is available
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
ExternalProject_FindPythonPackage(
MODULE_NAME "dicom"
REQUIRED
)
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
......
......@@ -3,15 +3,18 @@ set(proj python-pyparsing)
# Set dependency list
set(${proj}_DEPENDENCIES python)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if <proj> is available
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
ExternalProject_FindPythonPackage(
MODULE_NAME "pyparsing"
REQUIRED
)
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
......
......@@ -3,15 +3,18 @@ set(proj python-setuptools)
# Set dependency list
set(${proj}_DEPENDENCIES python python-packaging python-six python-appdirs)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if <proj> is available
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
ExternalProject_FindPythonPackage(
MODULE_NAME "setuptools"
REQUIRED
)
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
......
......@@ -3,15 +3,18 @@ set(proj python-six)
# Set dependency list
set(${proj}_DEPENDENCIES python)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if <proj> is available
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
ExternalProject_FindPythonPackage(
MODULE_NAME "six"
REQUIRED
)
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
......
......@@ -3,15 +3,18 @@ set(proj python-smmap)
# Set dependency list
set(${proj}_DEPENDENCIES python python-setuptools)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if <proj> is available
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
ExternalProject_FindPythonPackage(
MODULE_NAME "smmap"
REQUIRED
)
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
......
......@@ -3,15 +3,18 @@ set(proj python-wheel)
# Set dependency list
set(${proj}_DEPENDENCIES python python-setuptools)
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
# XXX - Add a test checking if <proj> is available
endif()
if(NOT DEFINED ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
set(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ${${CMAKE_PROJECT_NAME}_USE_SYSTEM_python})
ExternalProject_FindPythonPackage(
MODULE_NAME "wheel"
REQUIRED
)
endif()
if(NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
......
......@@ -36,8 +36,8 @@ if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
unset(PYTHON_INCLUDE_DIR CACHE)
unset(PYTHON_LIBRARY CACHE)
unset(PYTHON_EXECUTABLE CACHE)
find_package(PythonLibs REQUIRED)
find_package(PythonInterp REQUIRED)
find_package(PythonLibs 2.7 REQUIRED)
find_package(PythonInterp 2.7 REQUIRED)
set(PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIRS})
set(PYTHON_LIBRARY ${PYTHON_LIBRARIES})
set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
......
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