FindLua breaks due to INCLUDE_PREFIX
I'm having trouble with FindLua module in a cross-compilation environment but the problem is more general. The cause of the problem is the use of find_path(include/lua.h
instead of find_path(lua.h
. The command is already built for searching include folders. Manually adding include
breaks e.g. CMAKE_INCLUDE_PATH
.
Example:
set(CMAKE_INCLUDE_PATH /myluainstall/include) find_package(Lua)
The find_path
command will then look for /myluainstall/include/include/lua.h
and miss /myluainstall/include/lua.h
A better approach would be to get rid of LUA_INCLUDE_PREFIX
(https://github.com/Kitware/CMake/blob/acb97101628d900aca9bfc869f168c1f2bd1de30/Modules/FindLua.cmake#L126) and use subDir
as a PATH_SUFFIXES
-entry instead. find_path
could then directly set LUA_INCLUDE_DIR
which has the additional benefit of a "standard" CMake-Cache entry which the user can adjust (opposed to the kinda obscure LUA_INCLUDE_PREFIX
which cannot be changed by the user although it appears in the cache)