Hello,
I observed a problem trying to build a CMake based project using lua5.1 on a
system where both lua5.1 and lua5.2 are present (Linux Arch).
It seems, "Modules/FindLua51.cmake" causes the header for lua5.2 to be
found but the lib for version 5.1 causing obvious problems when trying to
link.
Using "strace" I observed that cmake searches in each path prefix first in
the subdirectory "include", then starting from the base directory.
As
Modules/FindLua51.cmake specifies
{{{
find_path(LUA_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua
include
}}}
Then cmake actually looks for lua.h in this folder order:
<prefix>/include/include/lua51/
<prefix>/include/include/lua5.1/
<prefix>/include/include/lua-5.1/
<prefix>/include/include/lua/
<prefix>/include/include/
<prefix>/include/
... next prefix ...
which looks wrong to me.
"strace" tells:
{{{
access("/usr/include/include/lua51/lua.h", R_OK) = -1 ENOENT (No such file or
directory)
access("/usr/include/include/lua5.1/lua.h", R_OK) = -1 ENOENT (No such file or
directory)
access("/usr/include/include/lua-5.1/lua.h", R_OK) = -1 ENOENT (No such file
or directory)
access("/usr/include/include/lua/lua.h", R_OK) = -1 ENOENT (No such file or
directory)
access("/usr/include/include/lua.h", R_OK) = -1 ENOENT (No such file or
directory)
access("/usr/include/lua.h", R_OK) = 0
}}}
So a file is found but this is actually the one from lua5.2. cmake should have
searched in
/usr/include/lua5.1/lua.h
in my case.
I deleted the additional "include/" in FindLua51.cmake and it worked.
A patch is attached.
I would be very happy for receiving feedback.
Regards,
Oliver Kurz>From 81c64867c4afaadf2388af79e0b685a2d64a675f Mon Sep 17 00:00:00 2001
From: Oliver Kurz <[email protected]>
Date: Sun, 8 Jun 2014 14:50:43 +0200
Subject: [PATCH] FindLua51: Correct include search path
cmake search starts in include-subdirectories by default.
---
Modules/FindLua51.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake
index 5b9ff91..dc84a0c 100644
--- a/Modules/FindLua51.cmake
+++ b/Modules/FindLua51.cmake
@@ -46,7 +46,7 @@
find_path(LUA_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
- PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include
+ PATH_SUFFIXES lua51 lua5.1 lua-5.1 lua include
PATHS
~/Library/Frameworks
/Library/Frameworks
--
1.9.3
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers