title: How to write a nice function that passes variables by reference?
body: <p>as in said in the title, I would like to write a "nice" function in cmake that is able to modify a variable which is passed as a parameter into that function. </p>
  
  <p>The only way I can think of doing it is ugly:</p>
  
  <p><em>Function definition</em></p>
  
  <pre><code>function(twice varValue varName)
  set(${varName} ${varValue}${varValue} PARENT_SCOPE)
  endfunction(twice)
  </code></pre>
  
  <p><em>Usage</em></p>
  
  <pre><code>set(arg foo)
  twice(${arg} arg)
  message("arg = "${arg})
  </code></pre>
  
  <p><em>Result</em></p>
  
  <pre><code>arg = foofoo
  </code></pre>
  
  <p>It seems to me, there is no real concept of variables that one can pass around at all?!
  I feel like there is something fundamental about cmake that I didn't take in yet.</p>
  
  <p>So, is there a nicer way to do this? </p>
  
  <p>Thanks a lot!</p>