Look for depot_tools only when DEPOT_TOOLS_PATH is set

This commit is contained in:
Axel Isouard 2017-03-12 12:29:01 +01:00
parent 470e444791
commit 638022675f
No known key found for this signature in database
GPG key ID: 4E64BB3EAAF31C29
2 changed files with 14 additions and 12 deletions

View file

@ -9,13 +9,14 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${CMAKE_SOURCE_DIR}/CMakeModules)
find_package(Git REQUIRED)
find_package(DepotTools REQUIRED)
if (WIN32)
set(PYTHON_EXECUTABLE ${DEPOTTOOLS_PATH}/python.bat)
else (WIN32)
find_package(PythonInterp REQUIRED)
endif (WIN32)
if (DEPOT_TOOLS_PATH)
find_package(DepotTools REQUIRED)
endif (DEPOT_TOOLS_PATH)
if (NOT WIN32)
find_package(PythonInterp 2.7 REQUIRED)
endif (NOT WIN32)
include(FindLibraries)
include(Version)

View file

@ -1,16 +1,17 @@
find_program(GCLIENT_EXECUTABLE
NAMES gclient gclient.bat
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/depot_tools)
DOC "Path to gclient executable"
HINTS ${DEPOT_TOOLS_PATH} ENV DEPOT_TOOLS_PATH)
find_path(DEPOTTOOLS_PATH
find_path(DEPOT_TOOLS_PATH
NAMES gclient gclient.py gclient.bat
gn gn.py gn.bat
ninja ninja.exe ninja-linux32 ninja-linux64 ninja-mac
download_from_google_storage download_from_google_storage.bat
download_from_google_storage.py
HINTS ${CMAKE_CURRENT_SOURCE_DIR}/depot_tools)
DOC "Path to depot_tools directory"
HINTS ${DEPOT_TOOLS_PATH} ENV DEPOT_TOOLS_PATH)
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(DepotTools
REQUIRED_VARS GCLIENT_EXECUTABLE
FAIL_MESSAGE "Could not find the gclient executable.")
REQUIRED_VARS GCLIENT_EXECUTABLE DEPOT_TOOLS_PATH
FAIL_MESSAGE "Could not find depot_tools.")