There is no variable named "variable" inside your macro. There is sort of like a "pre-processor token" 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"><<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a>></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>
I have a macro that takes a few arguments. Within the macro I am calling "configure_file" 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>
message(STATUS "----------------------------------")<br>
message(STATUS "variable: ${variable}")<br>
SET (Test_Variable "${variable}/Test_Output.cmake")<br>
CONFIGURE_FILE("<a href="http://Test.txt.in" target="_blank">Test.txt.in</a>" "Test.txt" @ONLY IMMEDIATE)<br>
endmacro(vartest variable)<br>
set (target "myTarget")<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 "dumb" part.. )<br>
<br>
Thanks for any help<br>
_________________________________________________________<br>
Mike Jackson <a href="mailto:mike.jackson@bluequartz.net" target="_blank">mike.jackson@bluequartz.net</a><br>
BlueQuartz Software <a href="http://www.bluequartz.net" target="_blank">www.bluequartz.net</a><br>
Principal Software Engineer 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>