CMAKE_FIND_ROOT_PATH_MODE_* not honored in 3.14.4
Using Leetal's iOS toolchain, I get an unconsistent behavior when using CMAKE_FIND_ROOT_PATH_MODE_*
with CMake 3.14.4. I am not sure if it is a bug or a different behavior, but at least I don't know how to deal with it.
Given the following CMakeLists.txt:
cmake_minimum_required(VERSION 3.1)
project(CMakeFindRootPathModeExample)
message("CMAKE_FIND_ROOT_PATH_MODE_PACKAGE: ${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}")
message("CMAKE_FIND_ROOT_PATH_MODE_PROGRAM: ${CMAKE_FIND_ROOT_PATH_MODE_PROGRAM}")
message("CMAKE_FIND_ROOT_PATH_MODE_INCLUDE: ${CMAKE_FIND_ROOT_PATH_MODE_INCLUDE}")
message("CMAKE_FIND_ROOT_PATH_MODE_LIBRARY: ${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY}")
And given that I run it with Leetal's iOS toolchain, like so:
cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/ios.toolchain.cmake ..
I get the following output, when running with cmake 3.14.4 (latest on homebrew):
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE: BOTH
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM: BOTH
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE: ONLY
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY: ONLY
When running with cmake 3.13.3 (latest on pip):
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE: BOTH
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM: BOTH
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE: BOTH
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY: BOTH
The latter is what I expect, given that the toolchain sets them to BOTH
:
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH CACHE STRING "" ${FORCE_CACHE})
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH CACHE STRING "" ${FORCE_CACHE})
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH CACHE STRING "" ${FORCE_CACHE})
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH CACHE STRING "" ${FORCE_CACHE})
endif()
Is that a bug, or a new behavior?