-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17310 from alebcay/trap-fetchcontent-provider
formula: trap CMake FetchContent usage instead of using FETCHCONTENT_FULLY_DISCONNECTED
- Loading branch information
Showing
2 changed files
with
17 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
cmake_minimum_required(VERSION 3.24) # Dependency providers introduced in CMake 3.24 | ||
|
||
option(HOMEBREW_ALLOW_FETCHCONTENT "Allow FetchContent to be used in Homebrew builds" OFF) | ||
|
||
if (HOMEBREW_ALLOW_FETCHCONTENT) | ||
return() | ||
endif() | ||
|
||
macro(trap_fetchcontent_provider method depName) | ||
message(FATAL_ERROR "Refusing to populate dependency '${depName}' with FetchContent while building in Homebrew, please use a formula dependency or add a resource to the formula.") | ||
endmacro() | ||
|
||
cmake_language( | ||
SET_DEPENDENCY_PROVIDER trap_fetchcontent_provider | ||
SUPPORTED_METHODS FETCHCONTENT_MAKEAVAILABLE_SERIAL | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters