Try GET_DIRECTORY_PROPERTY with VARIABLES -- it should give you a list of variables for that directory. It will only be accurate after the ADD_SUBDIRECTORY for the given directory...<br><br>The presence or absence of the variable in question should give you the &quot;defined-ness&quot; of it... As long as you can guarantee directory A gets added first...
<br><br>C:\&gt;cmake --help-command GET_DIRECTORY_PROPERTY<br>cmake version 2.4-patch 5<br>&nbsp; GET_DIRECTORY_PROPERTY<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get a property of the directory.<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GET_DIRECTORY_PROPERTY(VAR [DIRECTORY dir] property)
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get a property from the Directory.&nbsp; The value of the property is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stored in the variable VAR.&nbsp; If the property is not found, CMake will<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; report an error.&nbsp; The properties include: VARIABLES, CACHE_VARIABLES,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMMANDS, MACROS, INCLUDE_DIRECTORIES, LINK_DIRECTORIES, DEFINITIONS,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INCLUDE_REGULAR_EXPRESSION, LISTFILE_STACK, PARENT_DIRECTORY, and<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEFINITION varname.&nbsp; If the DIRECTORY argument is provided then the
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; property of the provided directory will be retrieved instead of the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; current directory.&nbsp; You can only get properties of a directory during<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; or after it has been traversed by cmake.<br><br>HTH,
<br>David<br><br><br><div><span class="gmail_quote">On 12/19/06, <b class="gmail_sendername">Mike Jackson</b> &lt;<a href="mailto:mike.jackson@imts.us">mike.jackson@imts.us</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="">well, that verified what I am seeing:<div>#-- from Project B CMakeLists.txt file</div><div>IF ( NOT DEFINED&nbsp; MHD_INTERFACE_LIB_NAME)</div><div>&nbsp; MESSAGE ( FATAL_ERROR &quot;MHD_INTERFACE_LIB_NAME is not defined and should be&quot;)
</div><div>ENDIF ( NOT DEFINED&nbsp; )</div><div><br></div><div>where&nbsp;MHD_INTERFACE_LIB_NAME is defined in Project A, and I want to use it in Project B.&nbsp;</div><div><br></div><div>When I run cmake on the project B directory I get the fatal error.
</div><div><br></div><div>So.. do I get access to variables in other CMakeLists.txt files that are included from top level cmake file?</div><div><br></div><div>Thanks</div><div><div> <span style="border-collapse: separate; border-spacing: 0px; color: rgb(0, 0, 0); font-family: Bitstream Vera Sans; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
<div style="margin: 0px;">--&nbsp;</div><span class="q"><div style="margin: 0px;">Mike Jackson &nbsp; Senior Research Engineer</div><div style="margin: 0px;">Innovative Management &amp; Technology Services</div><br></span></span> </div>
<div><span class="e" id="q_10f9c4377b6b9460_3"><br><div><div>On Dec 19, 2006, at 1:37 PM, David Cole wrote:</div><br><blockquote type="cite">DEFINED should be used with the variable name itself, not the value of the variable:
<br><br>IF(NOT DEFINED PROJECT_A_LIB_NAME)<br><br>Scratch the ${} and see what happens...<br><br><br><div><span class="gmail_quote">On 12/19/06, <b class="gmail_sendername">Mike Jackson</b> &lt;<a href="mailto:mike.jackson@imts.us" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
mike.jackson@imts.us</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> I have couple of projects, lets call them A and B. In project A I
<br>&quot;SET&quot; a variable as follows:<br><br>SET (PROJECT_A_LIB_NAME MyLib)<br><br>then use that further down A&#39;s cmake file in the ADD_LIBRARY() function. <br><br>Now in Project B I would like to automagically be able to read the
<br>PROJECT_A_LIB_NAME variable. I have&nbsp;&nbsp;added the &quot;ADD_SUBDIRECTORY<br>(PATH_TO_A BIN_DIR) to B&#39;s CMakeLists.txt file and then I tried just <br>using the variable like usual ( ${PROJECT_A_LIB_NAME} )&nbsp;&nbsp;but it is<br>
undefined.<br><br>IF (NOT DEFINED ${PROJECT_A_LIB_NAME} )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MESSAGE (FATAL_ERROR &quot;Ahh.. this is a problem&quot;)<br>ENDIF (NOT DEFINED ${PROJECT_A_LIB_NAME} ) <br><br>So.. is there a way to get the variable value from one 
CMakeLists.txt<br>file to another?<br><br>Thanks for any help.<br>--<br>Mike Jackson&nbsp;&nbsp; Senior Research Engineer<br>Innovative Management &amp; Technology Services <br><br><br><br>_______________________________________________
<br>CMake mailing list<br><a href="mailto:CMake@cmake.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">CMake@cmake.org</a><br><a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://www.cmake.org/mailman/listinfo/cmake </a><br></blockquote></div><br></blockquote></div><br></span></div></div></div>
</blockquote></div><br>