Alexander Neundorf wrote:
There was something...
If you override an already existing macro/command, the previous version is still available, but with an underscore prefixed, i.e. _find_library().
I'm not sure I remember correctly, but it was somethign close to this.
You remembered correctly... It works. Thank's...

The only funny thing (another cmake mystery) is that it did not work as a macro. This small program:

PROJECT(OpenMEEG)

CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)

MACRO(FIND_LIBRARY VAR)
   MESSAGE("${VAR} ${ARGN}")
   _FIND_LIBRARY(${VAR} ${ARGN})
ENDMACRO()

FIND_PACKAGE(PythonLibs)

fails with the message:

CMake Warning (dev) at CMakeLists.txt:6 (MESSAGE):
  Syntax error in cmake code at

    /tmp/test/CMakeLists.txt:6

  when parsing string

    PYTHON_LIBRARY
NAMES;python26;python2.6;PATHS;[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\InstallPath]/libs;PATH_SUFFIXES;python2.6/config;NO_SYSTEM_ENVIRONMENT_PATH

  Invalid escape sequence \S

Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
  "cmake --help-policy CMP0010" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPythonLibs.cmake:26 (FIND_LIBRARY)
  CMakeLists.txt:10 (FIND_PACKAGE)
This warning is for project developers.  Use -Wno-dev to suppress it.
[.... more messages of the same vein .....]

while this one (with function instead of macro) works....

PROJECT(OpenMEEG)

CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)

FUNCTION(FIND_LIBRARY VAR)
   MESSAGE("${VAR} ${ARGN}")
   _FIND_LIBRARY(${VAR} ${ARGN})
ENDFUNCTION()

FIND_PACKAGE(PythonLibs)
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to