diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-09-29 20:01:35 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-10-21 21:04:47 +0300 |
commit | e7a6917617fbb4f3c224ad89e6a63bedf56e6553 (patch) | |
tree | 74b74602bae4f332cfb59e42895759997f286492 /build_files/cmake/macros.cmake | |
parent | ebe231969294924ff057f5d999d05986f9c97352 (diff) |
Build: add option to error when features can't be enabled
This is to help ensure buildbot builds are correct, while still gracefully
disabling features in user/developer builds.
* Add WITH_STRICT_BUILD_OPTIONS to give an error when features can't be
enabled due to missing libraries or other reasons. Add new macro
set_and_warn_library_found used everywhere features were being
automatically disabled.
* Remove code from Windows and macOS for various libraries that would
automatically disable features. set_and_warn_library_found could be
used here also, but we are generally assuming the precompiled libraries
are complete and only test for availability when libraries are just
added.
Differential Revision: https://developer.blender.org/D16104
Diffstat (limited to 'build_files/cmake/macros.cmake')
-rw-r--r-- | build_files/cmake/macros.cmake | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 3acea19079b..8af45690862 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -1205,11 +1205,27 @@ macro(set_and_warn_dependency _dependency _setting _val) # when $_dependency is disabled, forces $_setting = $_val if(NOT ${${_dependency}} AND ${${_setting}}) - message(STATUS "'${_dependency}' is disabled: forcing 'set(${_setting} ${_val})'") + if(WITH_STRICT_BUILD_OPTIONS) + message(SEND_ERROR "${_dependency} disabled but required by ${_setting}") + else() + message(STATUS "${_dependency} is disabled, setting ${_setting}=${_val}") + endif() set(${_setting} ${_val}) endif() endmacro() +macro(set_and_warn_library_found + _library_name _library_found _setting) + if(NOT ${${_library_found}} AND ${${_setting}}) + if(WITH_STRICT_BUILD_OPTIONS) + message(SEND_ERROR "${_library_name} required but not found") + else() + message(STATUS "${_library_name} not found, disabling ${_setting}") + endif() + set(${_setting} OFF) + endif() +endmacro() + macro(without_system_libs_begin) set(CMAKE_IGNORE_PATH "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES};${CMAKE_SYSTEM_INCLUDE_PATH};${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES};${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}") endmacro() |