Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formula: trap CMake FetchContent usage instead of using FETCHCONTENT_FULLY_DISCONNECTED #17310

Merged
merged 1 commit into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Library/Homebrew/cmake/trap_fetchcontent_provider.cmake
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
)
2 changes: 1 addition & 1 deletion Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1808,7 +1808,7 @@ def std_cmake_args(install_prefix: prefix, install_libdir: "lib", find_framework
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_FIND_FRAMEWORK=#{find_framework}
-DCMAKE_VERBOSE_MAKEFILE=ON
-DFETCHCONTENT_FULLY_DISCONNECTED=ON
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=#{HOMEBREW_LIBRARY_PATH}/cmake/trap_fetchcontent_provider.cmake
-Wno-dev
-DBUILD_TESTING=OFF
]
Expand Down
Loading