Restore support for cross-compiling CMake itself

In commit eb583b0a66 (cmake_path command: path management, 2020-07-23,
v3.19.0-rc1~216^2~1) we added a `try_run`.  In cross-compilation mode,
C++ features tests must avoid running tests if there is no emulator
defined.
This commit is contained in:
Marc Chevrier
2021-01-17 15:31:52 +01:00
committed by Brad King
parent 19ff734e76
commit 6cee4c6a8b

View File

@@ -81,7 +81,13 @@ if(CMake_HAVE_CXX_MAKE_UNIQUE)
endif()
cm_check_cxx_feature(unique_ptr)
if (NOT CMAKE_CXX_STANDARD LESS "17")
cm_check_cxx_feature(filesystem TRY_RUN)
if (NOT CMAKE_CROSSCOMPILING OR CMAKE_CROSSCOMPILING_EMULATOR)
cm_check_cxx_feature(filesystem TRY_RUN)
else()
# In cross-compiling mode, it is not possible to check implementation bugs
# so rely only on conformance done by compilation
cm_check_cxx_feature(filesystem)
endif()
else()
set(CMake_HAVE_CXX_FILESYSTEM FALSE)
endif()