How to set up basic openMP project in CLion
<p>I am trying to run simple <code>OpenMP</code> program in <code>CLion IDE</code>.
When I run it I get an ERROR:</p>

<pre><code>CMakeFiles\openmp_test_clion.dir/objects.a(main.cpp.obj): In function `main':
D:/.../openmp_test_clion/main.cpp:9: undefined reference to 'omp_get_thread_num'
collect2.exe: error: ld returned 1 exit status
</code></pre>

<p>Here is my code:</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;omp.h&gt;

int main()
{
    int id;
#pragma omp parallel private(id)
    {
        id = omp_get_thread_num();
        printf("%d: Hello World!\n", id);
    }
    return 0;
}
</code></pre>

<p>Here is my <code>CMakeLists.txt</code>:</p>

<pre><code>cmake_minimum_required(VERSION 3.6)
project(openmp_test_clion)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp)
add_executable(openmp_test_clion ${SOURCE_FILES})

message(STATUS "Checking OpenMP")
find_package(OpenMP)
IF(OPENMP_FOUND)
    message("Found OpenMP!)
    # add flags for OpenMP
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OpenMP_SHARED_LINKER_FLAGS}")
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
ELSE()
    message("Missed OpenMP!")
ENDIF()
</code></pre>

<p>Here is screen of my toolchains:
<a href="https://i.stack.imgur.com/CJOfJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CJOfJ.png" alt="enter image description here"></a></p>

<p>I have zero experience with <code>OpenMP</code> and I am beginner programmer in <code>C++</code> so please give me a bit of an explanation how to setup my project.</p>