From 638022675f26922a19756165fb6c4ed596d9cead Mon Sep 17 00:00:00 2001 From: Axel Isouard Date: Sun, 12 Mar 2017 12:29:01 +0100 Subject: [PATCH] Look for depot_tools only when DEPOT_TOOLS_PATH is set --- CMakeLists.txt | 13 +++++++------ CMakeModules/FindDepotTools.cmake | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1235a67..00c466c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/CMakeModules/FindDepotTools.cmake b/CMakeModules/FindDepotTools.cmake index b714748..c23d4eb 100644 --- a/CMakeModules/FindDepotTools.cmake +++ b/CMakeModules/FindDepotTools.cmake @@ -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.")