Hi,
in cmake e.g. the FIND_LIBRARY() and friends calls return "NOTFOUND" if they
didn't succeed and this has the effect that they search again when cmake runs
the next time.
E.g. CHECK_LIBRARY_EXISTS() and CHECK_INCLUDE_FILES() don't seem to work that
way. If they fail, the value is set to "", and they don't try again. Is this
intentional ?
We have the problem that in FindX11.cmake the following call fails if the X11
development stuff isn't installed, and after installing it it doesn't check
again:
CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}"
CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
The attached patch helps against this, but I'm not sure it should really run
again every time.
Bye
Alex
--
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
Index: CheckLibraryExists.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CheckLibraryExists.cmake,v
retrieving revision 1.26
diff -b -u -p -r1.26 CheckLibraryExists.cmake
--- CheckLibraryExists.cmake 14 Jun 2006 16:28:29 -0000 1.26
+++ CheckLibraryExists.cmake 27 Feb 2007 22:10:17 -0000
@@ -14,7 +14,8 @@
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
- IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+
+ IF(NOT DEFINED ${VARIABLE} OR "${VARIABLE}" MATCHES "NOTFOUND")
SET(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION
"-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY}")
@@ -42,11 +43,11 @@ MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCT
"${OUTPUT}\n\n")
ELSE(${VARIABLE})
MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found")
- SET(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}")
+ SET(${VARIABLE} "NOTFOUND" CACHE INTERNAL "Have library ${LIBRARY}")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the function ${FUNCTION} exists in the ${LIBRARY} "
"failed with the following output:\n"
"${OUTPUT}\n\n")
ENDIF(${VARIABLE})
- ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
+ ENDIF(NOT DEFINED ${VARIABLE} OR "${VARIABLE}" MATCHES "NOTFOUND")
ENDMACRO(CHECK_LIBRARY_EXISTS)
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake