Skip to content
Open
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
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ option(COMPUTER_CPP_CODE_SIGN_APP "Code sign the macOS ComputerCpp.app bundle af
option(COMPUTER_CPP_ENABLE_WARNINGS "Enable strict compiler warnings for project targets" ON)
option(COMPUTER_CPP_ENABLE_SANITIZERS "Enable AddressSanitizer and UndefinedBehaviorSanitizer for project targets" OFF)

if(APPLE AND NOT DEFINED CACHE{CMAKE_FIND_FRAMEWORK})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using NOT DEFINED CACHE{CMAKE_FIND_FRAMEWORK} only checks if the variable is defined in the CMake cache. If a toolchain file or a parent scope defines CMAKE_FIND_FRAMEWORK as a normal variable, this check will evaluate to true and overwrite that setting with LAST.

Using NOT DEFINED CMAKE_FIND_FRAMEWORK is safer and more robust as it respects both cache overrides and normal variable overrides (e.g., from toolchain files or parent scopes).

if(APPLE AND NOT DEFINED CMAKE_FIND_FRAMEWORK)

# Prefer SDK/Homebrew libraries over stale third-party framework bundles in /Library/Frameworks.
set(CMAKE_FIND_FRAMEWORK LAST)
endif()

function(computer_cpp_target_defaults target_name)
target_compile_features(${target_name} PRIVATE cxx_std_20)

Expand Down
3 changes: 2 additions & 1 deletion src/cli/LuaPrelude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2563,6 +2563,7 @@ if not script then
os.exit(2)
end
table.remove(arg, 1)
local unpack_args = table.unpack or unpack

local chunk, load_error = loadfile(script)
if not chunk then
Expand All @@ -2571,7 +2572,7 @@ if not chunk then
end

local function main()
return chunk(table.unpack(arg))
return chunk(unpack_args(arg))
end

local ok, result = xpcall(main, debug.traceback)
Expand Down