Documentation for FindLua has always been incorrect from my end.

As far back as I can remember, the documentation for FindLua has never matched the behavior I have observed in CMake proper. Lua_FOUND has never been defined after a call to find_package(Lua) (as opposed to LUA_FOUND, which is 1) and this includes CMake 4.2, the version where the all-caps version was ostensibly deprecated and which I just downloaded. In fact, none of the variables prefixed with the proper-casing spelling of Lua have ever been defined for me, on any machine where I’ve used CMake. I don’t know if something has, by some cursed happenstance, always been misconfigured on my computers to cause this behavior but that seems improbable, so is the documentation just wrong? Is CMake itself bugged? Do I need to opt into the switch to proper casing with a policy flag or something?

I’m at a loss.

P.S. you can use this snippet to verify my claim on your end.

find_package(Lua)
message("Lua found: ${Lua_FOUND}")
message("LUA FOUND: ${LUA_FOUND}")

Edit: Nevermind, this is because of a flaky vcpkg wrapper script. I’m writing them a bug report about it.

It works fine for me:

$ cat ../CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(TestLua C)
find_package(Lua)
message(STATUS "Lua found: ${Lua_FOUND}")
message(STATUS "LUA FOUND: ${LUA_FOUND}")

With CMake 4.2.1:

$ cmake ..
...
-- Found Lua: ... (found version "5.4.8")
-- Lua found: TRUE
-- LUA FOUND: TRUE

With CMake 3.10.3:

$ cmake ..
...
-- Found Lua: ... (found version "5.3.6")
-- Lua found: TRUE
-- LUA FOUND: TRUE
1 Like

Ah, thanks.

1 Like

Here’s the report, for the curious.