Commit e91ba553 authored by Ben Boeckel's avatar Ben Boeckel

cmake: move cross compiling logic into its own module

parent ada3b953
# Full functional CMAKE_CROSSCOMPILING_EMULATOR support for custom_command and
# custom_target is available in CMake 3.8.0
# It was first added in CMake 3.6.0 and later fixed in CMake 3.8.0 (commit e7480d67, CMake issue #16288)
set(_vtk_crosscompiling_emulator_support_custom_target 1)
if(CMAKE_VERSION VERSION_LESS "3.8.0")
set(_vtk_crosscompiling_emulator_support_custom_target 0)
endif()
# Maintain backward compatibility with user setting COMPILE_TOOLS_IMPORTED
if(DEFINED COMPILE_TOOLS_IMPORTED AND NOT DEFINED VTK_COMPILE_TOOLS_IMPORTED)
set(VTK_COMPILE_TOOLS_IMPORTED ${COMPILE_TOOLS_IMPORTED})
unset(COMPILE_TOOLS_IMPORTED)
endif()
# Variable VTK_COMPILE_TOOLS_IMPORTED is preferred
if(NOT DEFINED VTK_COMPILE_TOOLS_IMPORTED)
set(VTK_COMPILE_TOOLS_IMPORTED FALSE)
endif()
if(CMAKE_CROSSCOMPILING
AND NOT VTK_COMPILE_TOOLS_IMPORTED
AND (NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR
OR NOT _vtk_crosscompiling_emulator_support_custom_target)
)
# if CMAKE_CROSSCOMPILING is true and crosscompiling emulator is not available, we need
# to import build-tools targets.
find_package(VTKCompileTools REQUIRED)
set(VTK_COMPILE_TOOLS_IMPORTED TRUE)
endif()
......@@ -18,6 +18,7 @@ include(vtkDownload)
include(vtkTesting)
include(vtkDirectories)
include(vtkMobileDevices)
include(vtkCrossCompiling)
# Objective-C++ compile flags.
# CMake has no equivalent of CMAKE_CXX_FLAGS for Objective-C++ (bug #4756)
......@@ -41,32 +42,6 @@ set(VTK_USE_SYSTEM_GLEW OFF CACHE BOOL "do not use a system glew")
set(VTK_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
# Full functional CMAKE_CROSSCOMPILING_EMULATOR support for custom_command and
# custom_target is available in CMake 3.8.0
# It was first added in CMake 3.6.0 and later fixed in CMake 3.8.0 (commit e7480d67, CMake issue #16288)
set(_crosscompiling_emulator_support_custom_target 1)
if(CMAKE_VERSION VERSION_LESS 3.8.0)
set(_crosscompiling_emulator_support_custom_target 0)
endif()
# Maintain backward compatibility with user setting COMPILE_TOOLS_IMPORTED
if(DEFINED COMPILE_TOOLS_IMPORTED AND NOT DEFINED VTK_COMPILE_TOOLS_IMPORTED)
set(VTK_COMPILE_TOOLS_IMPORTED ${COMPILE_TOOLS_IMPORTED})
endif()
# Variable VTK_COMPILE_TOOLS_IMPORTED is preferred
if(NOT DEFINED VTK_COMPILE_TOOLS_IMPORTED)
set(VTK_COMPILE_TOOLS_IMPORTED FALSE)
endif()
if(CMAKE_CROSSCOMPILING
AND NOT VTK_COMPILE_TOOLS_IMPORTED
AND (NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR
OR NOT _crosscompiling_emulator_support_custom_target)
)
# if CMAKE_CROSSCOMPILING is true and crosscompiling emulator is not available, we need
# to import build-tools targets.
find_package(VTKCompileTools REQUIRED)
set(VTK_COMPILE_TOOLS_IMPORTED TRUE)
endif()
#-----------------------------------------------------------------------------
# Add the Remote Subdirectory
add_subdirectory(Remote)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment