title: Defining preprocessor in modern CMake
body: <p>I'm currently learning CMake and don't want to get bad habits since there is always 2 ways to do something in CMake (old way and modern way from what I have seen)</p>
  
  <p>After reading some documentation about preprocessor in CMake and checking this post:
  <a href="https://stackoverflow.com/questions/9017573/define-preprocessor-macro-through-cmake">Define preprocessor macro through cmake</a></p>
  
  <p>I've come to the conclusion that I could either define a preprocessor as :</p>
  
  <ul>
  <li><code>add_compile_definitions(FOO)</code></li>
  <li><code>target_compile_definitions(myTarget PRIVATE FOO)</code>    </li>
  <li><code>add_definitions(-DFOO)</code></li>
  </ul>
  
  <p>and after some test they does actually all works as intended and define <code>FOO</code></p>
  
  <p>But now my question is what's the most "modern" way that I should use and what is really the difference between each functions, the only difference I noticed is that if I use <code>target_compile_definitions(myTarget PUBLIC FOO)</code> it then define <code>FOO</code>in parent target.</p>