Hi,<br><br><div class="gmail_quote">On Fri, Jun 29, 2012 at 2:44 PM, Christian Arnault <span dir="ltr"><<a href="mailto:arnault@lal.in2p3.fr" target="_blank">arnault@lal.in2p3.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
I wanted to factor out some initial stuff of my <font face="Courier
New, Courier, monospace">CMakeLists.txt</font> that I
systematically include.<br>
<br>
typically I include the following lines at the beginning of all my
CMakeLists.txt:<br>
<br>
<font face="Courier New, Courier, monospace">cmake_minimum_required(VERSION
2.8)<br>
function (AA)<br>
message ("calling AA")<br>
endfunction()<br>
<br>
AA()<br>
</font><br>
Then I thought by using the -C option as follows:<br>
<br>
<font face="Courier New, Courier, monospace">> cmake --build=. -C
%CMTROOT%\Init.cmake ..\CMakeLists.txt</font><br>
<br>
with Init.cmake file containing<br>
<br>
<font face="Courier New, Courier, monospace">function(AA)<br>
message("calling aaaa")<br>
endfunction()<br>
</font><br>
This would be equivalent.<br>
<br>
Apparently this is not the case. In particular, the function
definitions are not transmitted by this mechanism<br>
<br>
<font face="Courier New, Courier, monospace">loading initial cache
file ...\Init.cmake<br>
</font><br>
... the functions defined in <font face="Courier New, Courier,
monospace">Init.cmake </font>are not recognized<br></div></blockquote><div><br></div><div>The cmake manual explains why this happens, the script is only executed to prefill the cache file, its not prepended to the cmakelists.txt files that are being run.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
Of course I could 'manually' include my module in all CMakeLists.txt
but ...<br>
<br>
Can someone explain why?<br>
<br>
Or, how could I obtain what I need?<br></div></blockquote><div><br></div><div>Use include() in your cmakelists.txt files.</div><div><br></div><div>Andreas</div></div>