BundleUtilities: Disallow inclusion at configure time

This commit adds a new CMake policy, CMP0080, which prohibits the
inclusion of BundleUtilities at configure time. The old behavior is
to allow the inclusion.
This commit is contained in:
Kyle Edwards
2018-09-12 13:33:04 -04:00
parent fd28ea35ca
commit eedd91ab08
14 changed files with 76 additions and 1 deletions

View File

@@ -224,6 +224,20 @@ that are already also in the bundle... Anything that points to an
external file causes this function to fail the verification.
#]=======================================================================]
# Do not include this module at configure time!
if(DEFINED CMAKE_GENERATOR)
cmake_policy(GET CMP0080 _BundleUtilities_CMP0080)
if(_BundleUtilities_CMP0080 STREQUAL "NEW")
message(FATAL_ERROR "BundleUtilities cannot be included at configure time!")
elseif(NOT _BundleUtilities_CMP0080 STREQUAL "OLD")
message(AUTHOR_WARNING
"Policy CMP0080 is not set: BundleUtilities prefers not to be included at configure time. "
"Run \"cmake --help-policy CMP0080\" for policy details. "
"Use the cmake_policy command to set the policy and suppress this warning."
)
endif()
endif()
# The functions defined in this file depend on the get_prerequisites function
# (and possibly others) found in:
#