2007/11/6, Thomas Sondergaard <[EMAIL PROTECTED]>:
> Is there a beginners guide to macros somewhere? I tried something basic
> like wrapping up find_library like this:
>
> macro(my_find_library arg1 arg2)
>    find_library(arg1 arg2)
> endmacro(my_find_library)
>
> my_find_library(CPPUNIT cppunit)
>
> To my surprise it didn't work at all. If I browse CMakeCache.txt there
> is no reference to CPPUNIT. If I call find_library directly it works!

You need to use the value (${arg1} ${arg2}) of the arguments and not
the arg name itself.

Try this:

macro(my_find_library arg1 arg2)
   message(arg1)
   message(arg2)
   message("arg1 = ${arg1}")
   message("arg2 = ${arg2}")
endmacro(my_find_library)

my_find_library(TOTO titi)

If you need more example of MACRO usage you look at
CMake distros modules directory.
For example:
CheckTypeSize.cmake
CheckFunctionExists.cmake
or any other containing MACRO.
-- 
Erk
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to