@@ -248,6 +248,13 @@ if(NOT VTK_BUILD_PYTHON_MODULE_DIR)
248248 PATH "Directory where python modules will be put inside the build tree" )
249249 mark_as_advanced (VTK_BUILD_PYTHON_MODULE_DIR)
250250endif ()
251+ # Full functional CMAKE_CROSSCOMPILING_EMULATOR support for custom_command and
252+ # custom_target is available in CMake 3.8.0
253+ # It was first added in CMake 3.6.0 and later fixed in CMake 3.8.0 (commit e7480d67, CMake issue #16288)
254+ set (_crosscompiling_emulator_support_custom_target 1)
255+ if (CMAKE_VERSION VERSION_LESS 3.8.0)
256+ set (_crosscompiling_emulator_support_custom_target 0)
257+ endif ()
251258# Maintain backward compatibility with user setting COMPILE_TOOLS_IMPORTED
252259if (DEFINED COMPILE_TOOLS_IMPORTED AND NOT DEFINED VTK_COMPILE_TOOLS_IMPORTED)
253260 set (VTK_COMPILE_TOOLS_IMPORTED ${COMPILE_TOOLS_IMPORTED} )
@@ -256,7 +263,11 @@ endif()
256263if (NOT DEFINED VTK_COMPILE_TOOLS_IMPORTED)
257264 set (VTK_COMPILE_TOOLS_IMPORTED FALSE )
258265endif ()
259- if (CMAKE_CROSSCOMPILING AND NOT VTK_COMPILE_TOOLS_IMPORTED AND NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
266+ if (CMAKE_CROSSCOMPILING
267+ AND NOT VTK_COMPILE_TOOLS_IMPORTED
268+ AND NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR
269+ AND NOT _crosscompiling_emulator_support_custom_target
270+ )
260271 # if CMAKE_CROSSCOMPILING is true and crosscompiling emulator is not available, we need
261272 # to import build-tools targets.
262273 find_package (VTKCompileTools REQUIRED)
0 commit comments