There is no variable named &quot;variable&quot; inside your macro. There is sort of like a &quot;pre-processor token&quot; that gets substituted in every place ${variable} is referenced as the macro is expanded for use. (Not exactly alike, but very similar to the C pre-processor macro concept... (#define))<br>
<br><div>If you want a variable named the same as your macro parameter for use in configure_file or other things that require actual variables, simply do this inside your macro:</div><div>set(variable ${variable})<br><div class="gmail_quote">
<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">HTH,</div><div class="gmail_quote">David</div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">On Wed, Feb 4, 2009 at 9:04 AM, Michael Jackson <span dir="ltr">&lt;<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Not sure what I am doing wrong but here is my problem.<br>
 &nbsp;I have a macro that takes a few arguments. Within the macro I am calling &quot;configure_file&quot; and in the file that gets configured I am using the values of the arguments. Unfortunately after the file is configured during cmake time the values are blank. Here is a concise test case.<br>

<br>
<br>
#---- CMakeLists.txt file Begin<br>
cmake_minimum_required(VERSION 2.6)<br>
macro(vartest variable)<br>
 &nbsp;message(STATUS &quot;----------------------------------&quot;)<br>
 &nbsp;message(STATUS &quot;variable: ${variable}&quot;)<br>
 &nbsp;SET (Test_Variable &quot;${variable}/Test_Output.cmake&quot;)<br>
 &nbsp;CONFIGURE_FILE(&quot;<a href="http://Test.txt.in" target="_blank">Test.txt.in</a>&quot; &quot;Test.txt&quot; @ONLY IMMEDIATE)<br>
endmacro(vartest variable)<br>
set (target &quot;myTarget&quot;)<br>
vartest(${target})<br>
#---- CMakeLists.txt file End<br>
<br>
# ---- <a href="http://Test.txt.in" target="_blank">Test.txt.in</a> Begin<br>
variable = @variable@<br>
Test_Variable = @Test_Variable@<br>
# ---- Test. <a href="http://txt.in" target="_blank">txt.in</a> End<br>
<br>
The output I get from Cmake is:<br>
509:[mjackson@Shepard-2:Build]$ cmake ../<br>
-- ----------------------------------<br>
-- variable: myTarget<br>
-- Configuring done<br>
-- Generating done<br>
-- Build files have been written to: /Users/mjackson/Desktop/Test/Build<br>
<br>
<br>
and the txt file looks like this:<br>
variable =<br>
Test_Variable = myTarget/Test_Output.cmake<br>
<br>
Is this a bug or something I am doing wrong or am I just not understanding something basic about macros. (Probably the &quot;dumb&quot; part.. )<br>
<br>
Thanks for any help<br>
_________________________________________________________<br>
Mike Jackson &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="mailto:mike.jackson@bluequartz.net" target="_blank">mike.jackson@bluequartz.net</a><br>
BlueQuartz Software &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.bluequartz.net" target="_blank">www.bluequartz.net</a><br>
Principal Software Engineer &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Dayton, Ohio<br>
<br>
<br>
<br>
_______________________________________________<br>
CMake mailing list<br>
<a href="mailto:CMake@cmake.org" target="_blank">CMake@cmake.org</a><br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br></div>