From f65882cca6411461373995b5da4aef85bbbb4841 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 14 Aug 2018 10:07:22 +0200 Subject: [PATCH] cmake: Fix optional ABIMap detection Signed-off-by: Andreas Schneider Reviewed-by: Anderson Toshiyuki Sasaki --- cmake/Modules/FindABIMap.cmake | 35 +++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/cmake/Modules/FindABIMap.cmake b/cmake/Modules/FindABIMap.cmake index 78bfa36a..e70fbad3 100644 --- a/cmake/Modules/FindABIMap.cmake +++ b/cmake/Modules/FindABIMap.cmake @@ -202,19 +202,30 @@ # # Search for python which is required -find_package(PythonInterp REQUIRED) +if (ABIMap_FIND_REQURIED) + find_package(PythonInterp REQUIRED) +else() + find_package(PythonInterp) +endif() -# Search for abimap tool used to generate the map files -find_program(ABIMAP_EXECUTABLE NAMES abimap DOC "path to the abimap executable") -mark_as_advanced(ABIMAP_EXECUTABLE) -if (NOT ABIMAP_EXECUTABLE AND UNIX) - message(STATUS "Could not find `abimap` in PATH." - " It can be found in PyPI as `abimap`" - " (try `pip install abimap`)") -else () - set(ABIMAP_FOUND TRUE) -endif () +if (PYTHONINTERP_FOUND) + # Search for abimap tool used to generate the map files + find_program(ABIMAP_EXECUTABLE NAMES abimap DOC "path to the abimap executable") + mark_as_advanced(ABIMAP_EXECUTABLE) + + if (NOT ABIMAP_EXECUTABLE AND UNIX) + message(STATUS "Could not find `abimap` in PATH." + " It can be found in PyPI as `abimap`" + " (try `pip install abimap`)") + endif () + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(ABIMap REQUIRED_VARS ABIMAP_EXECUTABLE) +endif() + + +if (ABIMAP_FOUND) # Define helper scripts set(_EXTRACT_SYMBOLS_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/ExtractSymbols.cmake) @@ -392,3 +403,5 @@ function(generate_map_file _TARGET_NAME) ) endif() endfunction() + +endif (ABIMAP_FOUND)