From 2b924ac85dac1312828a16a6e270908b0dd15c21 Mon Sep 17 00:00:00 2001 From: Liu Yiqun Date: Tue, 9 May 2017 11:29:12 +0800 Subject: [PATCH] Disable the finding of PythonLibs when WITH_PYTHON is set to OFF. --- cmake/external/python.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/external/python.cmake b/cmake/external/python.cmake index fc66d6b215..f4d0daab06 100644 --- a/cmake/external/python.cmake +++ b/cmake/external/python.cmake @@ -16,11 +16,13 @@ INCLUDE(ExternalProject) INCLUDE(python_module) FIND_PACKAGE(PythonInterp 2.7) -FIND_PACKAGE(PythonLibs 2.7) +IF(WITH_PYTHON) + FIND_PACKAGE(PythonLibs 2.7) +ENDIF(WITH_PYTHON) SET(py_env "") SET(USE_VIRTUALENV_FOR_TEST 1) -IF(PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND) +IF(PYTHONINTERP_FOUND) find_python_module(pip REQUIRED) find_python_module(numpy REQUIRED) find_python_module(wheel REQUIRED) @@ -30,7 +32,7 @@ IF(PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND) MESSAGE(FATAL_ERROR "Found Python Protobuf ${PY_GOOGLE.PROTOBUF_VERSION} < 3.0.0, " "please use pip to upgrade protobuf. pip install -U protobuf") ENDIF() -ELSE(PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND) +ELSE(PYTHONINTERP_FOUND) MESSAGE(FATAL_ERROR "Please install python 2.7 before building PaddlePaddle.") ##################################### PYTHON ######################################## SET(PYTHON_SOURCES_DIR ${THIRD_PARTY_PATH}/python) @@ -217,7 +219,7 @@ ELSE(PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND) LIST(APPEND external_project_dependencies python setuptools six cython wheel python-protobuf numpy) -ENDIF(PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND) +ENDIF(PYTHONINTERP_FOUND) IF(WITH_PYTHON) INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIR}) -- GitLab