title: undefined reference to `pthread_create' CLion
body: <p>I'm trying to compile my program using CLion under Linux (Ubuntu) OS.</p>
  
  <p>My CMake file:</p>
  
  <pre><code># cmake_minimum_required(VERSION 3.5)
    project(untitled2 C)
  
    set(CMAKE_C_STANDARD 99)
    set(CMAKE_CXX_FLAGS -pthread)
    add_executable(untitled2 main.c)
  </code></pre>
  
  <p>My pragram using threads so <strong><em>I've added</em></strong> <code>set(CMAKE_CXX_FLAGS -pthread)</code> that required to compile my program.
  I got a compilation error: "undefined reference to pthread_create"</p>
  
  <p>I can compile the program via the terminal using the following:</p>
  
  <pre><code>gcc main.c -o main -pthread
  </code></pre>
  
  <p>I think that my issue is with the CMake file. 
  Can someone please help my with that matter ?</p>
  
  <p>Thank you!</p>