title: Add c++ compiler flags using CMake
body: <p>I am quite new to the whole CMake logic and syntax. For the code I am working on, I need to use the <code>cap_set_proc</code> function to work with a process capabilities flags (<a href="http://man7.org/linux/man-pages/man3/cap_set_proc.3.html" rel="nofollow noreferrer">man link</a>). So I decided to start with a really stupid piece of code that you see here:</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;string&gt;
  #include&lt;sys/capability.h&gt;
  
  using namespace std;
  
  int main(){
  
      cap_t test = cap_get_proc();
      string whatsTest(cap_to_text(test,nullptr));
      cout&lt;&lt;whatsTest&lt;&lt;endl;
  
      return 0;
  
  }
  </code></pre>
  
  <p>(For the moment, I do not care if the code I wrote makes any sense...)<br>
  Now, if I simply use <code>c++</code> (as shown below) everything compiles fine and the executable runs without any issue:</p>
  
  <pre><code>c++ test_main.cpp -o test_cap -lcap
  </code></pre>
  
  <p>The problem is that the project I am working one is pretty huge and relies on CMake pretty heavily. So I wanted to compile the same code but using CMake... How do I write a CMakeLists.txt file that allows me to obtain the same result as the compiler instruction shown in the previous lines?</p>