Skip to content

Commit 894acce

Browse files
committed
cmake: Import VTKCompileTools if CROSSCOMPILING_EMULATOR support is incomplete
Suggested-by: Ben Boeckel <ben.boeckel@kitware.com>
1 parent d0f83df commit 894acce

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)
250250
endif()
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
252259
if(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()
256263
if(NOT DEFINED VTK_COMPILE_TOOLS_IMPORTED)
257264
set(VTK_COMPILE_TOOLS_IMPORTED FALSE)
258265
endif()
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

Comments
 (0)