[CMake] Double redefinition of commands...

Theodore Papadopoulo Theodore.Papadopoulo at inria.fr
Thu May 19 12:11:54 EDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

	Hello,

I'm facing with the following problem, I'm using the _XXX trick to
access the previous version of a command. Unfortunately, this is not
quite what I need because of a double redefinition of the command.

Here is a small example of the problem I have:

PROJECT(Test)

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

FIND_LIBRARY(ZLIB z)

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

FIND_LIBRARY(GTKLIB gtk)

In the second call "FIND_LIBRARY(GTKLIB gtk)", _FIND_LIBRARY refers to
the first definition and the call to that function just loops forever.
Browsing cmake sources reveals that basically cmake just renames the old
function XXX into _XXX. If _XXX already exists, it is suppressed (if I
understood well).

What I would need is a reference to the original FIND_LIBRARY (the one
provided by cmake), but I see no way of doing it. Any idea.

Another, probably more powerful idea, would be to allow users to rename
functions as they wish. This is probably not too difficult as Cmake
already contains code to do that.

And finally, no I cannot suppress the two redefinitions as they are in
two different sub-projects that need to be built separately or together.

Any idea will be appreciated.

	Thank's a lot.

		Theo.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk3VQUkACgkQEr8WrU8nPV1vWQCgo9XBct99/nk0ppMIBaiCvX1F
V78AnAoCdaElXewc6drjrNWcgrAHpXDD
=PYnv
-----END PGP SIGNATURE-----


More information about the CMake mailing list