On Tuesday 06 January 2009 21:03:53 Perrin Alexandre wrote: > Hi everyone, > CMake doesn't fail when it found lua-5.1 installation without having > successfully found the LUA_LIBRARIES. Then, compilation will fail at the > very end (linker) which isn't "user friendly". > > For me it's a CMake bug. Why the hell CMake would set LUA_FOUND if > LUA_LIBRARIES is not set? > Anyway I've got a work-around patch which make CMake fail if LUA_LIBRARIES > is not set, which seems to me the correct behaviour. > > To be able to compile under FreeBSD I have to give a hint to cmake with: > cmake -DLUA_LIBRARIES=/usr/local/lib/lua51/liblua.so > > It seems pretty much the same problem as > http://awesome.naquadah.org/bugs/index.php?do=details&task_id=300 > But then, the given fix is a hack (that doesn't even work on FreeBSD-7.1- > RELEASE). > I've attached the build without the patch (fail at link step) with > CMAKE_VERBOSE_MAKEFILE set, could maybe help, since my patch is only a > workaround :) > > Have a nice day. > Regards, > Perrin Alexandre OK I got it. we have:
set( LUA_FOUND LUA51_FOUND OR LUA50_FOUND )# This is a workaround to a cmake
bug
if(NOT LUA_FOUND)
message(FATAL_ERROR "lua library not found")
endif()
which is expanded to:
if(NOT LUA51_FOUND OR LUA50_FOUND)
which is *NOT* what we expect.
http://www.cmake.org/Wiki/CMake/Language_Syntax#Join_a_list_with_semicolons.
seems the closest explanation.
If you have any doubt just try this into a CMakeLists.txt:
set(FOO FALSE OR FALSE)
if(NOT FOO)
message(FATAL_ERROR "you should see me")
endif(NOT FOO)
You won't see the message.
Patch attached, $SOMEONE should check for other if() in CMake's files :)
JD can you avoid pushing my last patch and apply this one instead? sorry :S
Regards,
Perrin Alexandre.
From 77fb2da6739a0b28c2b6d70c0acbdb18a9495be0 Mon Sep 17 00:00:00 2001
From: Perrin "kAworu" Alexandre <kaworu(a)kaworu,ch>
Date: Tue, 6 Jan 2009 22:21:40 +0100
Subject: [PATCH] fixed CMake logic error in Lua detection.
Signed-off-by: Perrin "kAworu" Alexandre <kaworu(a)kaworu,ch>
---
awesomeConfig.cmake | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake
index 454c1f1..6d5cc42 100644
--- a/awesomeConfig.cmake
+++ b/awesomeConfig.cmake
@@ -165,8 +165,7 @@ a_find_library(LIB_READLINE readline)
a_find_library(LIB_EV ev)
# Error check
-set( LUA_FOUND LUA51_FOUND OR LUA50_FOUND )# This is a workaround to a cmake bug
-if(NOT LUA_FOUND)
+if(NOT LUA51_FOUND AND NOT LUA50_FOUND) # This is a workaround to a cmake bug
message(FATAL_ERROR "lua library not found")
endif()
--
1.6.0.6
signature.asc
Description: This is a digitally signed message part.
