mirror of
https://github.com/opencv/opencv.git
synced 2025-07-25 22:57:53 +08:00
cmake(android): update CMAKE_FIND_ROOT_PATH_MODE_* handling
Avoids this error message with CMake 3.10: CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool. Related changes is that pkg-config tool is found (/usr/bin/pkg-config).
This commit is contained in:
parent
0e6dd32858
commit
d01a2038ae
@ -1596,16 +1596,49 @@ set( CMAKE_FIND_ROOT_PATH
|
|||||||
"${CMAKE_INSTALL_PREFIX}/share" )
|
"${CMAKE_INSTALL_PREFIX}/share" )
|
||||||
|
|
||||||
# only search for libraries and includes in the ndk toolchain
|
# only search for libraries and includes in the ndk toolchain
|
||||||
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
|
if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
|
||||||
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
|
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
|
||||||
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
|
||||||
|
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
|
||||||
|
set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
|
||||||
|
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
macro(__cmake_find_root_save_and_reset)
|
||||||
|
foreach(v
|
||||||
|
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
|
||||||
|
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
|
||||||
|
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
|
||||||
|
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
|
||||||
|
)
|
||||||
|
set(__save_${v} ${${v}})
|
||||||
|
set(${v} NEVER)
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(__cmake_find_root_restore)
|
||||||
|
foreach(v
|
||||||
|
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
|
||||||
|
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
|
||||||
|
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
|
||||||
|
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
|
||||||
|
)
|
||||||
|
set(${v} ${__save_${v}})
|
||||||
|
unset(__save_${v})
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# macro to find packages on the host OS
|
# macro to find packages on the host OS
|
||||||
macro( find_host_package )
|
macro( find_host_package )
|
||||||
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
|
__cmake_find_root_save_and_reset()
|
||||||
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )
|
|
||||||
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER )
|
|
||||||
if( CMAKE_HOST_WIN32 )
|
if( CMAKE_HOST_WIN32 )
|
||||||
SET( WIN32 1 )
|
SET( WIN32 1 )
|
||||||
SET( UNIX )
|
SET( UNIX )
|
||||||
@ -1617,17 +1650,13 @@ macro( find_host_package )
|
|||||||
SET( WIN32 )
|
SET( WIN32 )
|
||||||
SET( APPLE )
|
SET( APPLE )
|
||||||
SET( UNIX 1 )
|
SET( UNIX 1 )
|
||||||
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
|
__cmake_find_root_restore()
|
||||||
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
|
|
||||||
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
# macro to find programs on the host OS
|
# macro to find programs on the host OS
|
||||||
macro( find_host_program )
|
macro( find_host_program )
|
||||||
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
|
__cmake_find_root_save_and_reset()
|
||||||
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )
|
|
||||||
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER )
|
|
||||||
if( CMAKE_HOST_WIN32 )
|
if( CMAKE_HOST_WIN32 )
|
||||||
SET( WIN32 1 )
|
SET( WIN32 1 )
|
||||||
SET( UNIX )
|
SET( UNIX )
|
||||||
@ -1639,9 +1668,7 @@ macro( find_host_program )
|
|||||||
SET( WIN32 )
|
SET( WIN32 )
|
||||||
SET( APPLE )
|
SET( APPLE )
|
||||||
SET( UNIX 1 )
|
SET( UNIX 1 )
|
||||||
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
|
__cmake_find_root_restore()
|
||||||
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
|
|
||||||
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user