find Python and add External subdir only if BUILD_EXTERNAL option was set (on by default) and /External dir exists

This commit is contained in:
Fabian Wahlster 2019-10-15 11:00:23 +02:00
parent 765cee8441
commit 03be018a47

View File

@ -13,6 +13,7 @@ include(GNUInstallDirs)
include(CMakeDependentOption) include(CMakeDependentOption)
option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF) option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
option(BUILD_EXTERNAL "Build external dependencies in /External" ON)
set(LIB_TYPE STATIC) set(LIB_TYPE STATIC)
@ -148,12 +149,12 @@ endfunction(glslang_set_link_args)
# CMake needs to find the right version of python, right from the beginning, # CMake needs to find the right version of python, right from the beginning,
# otherwise, it will find the wrong version and fail later # otherwise, it will find the wrong version and fail later
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/External) if(BUILD_EXTERNAL AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/External)
find_package(PythonInterp 3 REQUIRED) find_package(PythonInterp 3 REQUIRED)
endif()
# We depend on these for later projects, so they should come first. # We depend on these for later projects, so they should come first.
add_subdirectory(External) add_subdirectory(External)
endif()
if(NOT TARGET SPIRV-Tools-opt) if(NOT TARGET SPIRV-Tools-opt)
set(ENABLE_OPT OFF) set(ENABLE_OPT OFF)