title: C Cmake setup - undefined reference to pow() (despite -lm)
body: <p>I'm trying to build a project (with CLion) with the following <code>CMakeLists.txt</code>:</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.6)
  project(alfa_1)
  
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c11 -Wall -Wextra -lm")
  
  set(SOURCE_FILES
          src/foo.h
          src/foo.c
          src/bar.h
          src/bar.c
          src/parser.h
          src/parser.c)
  
  add_executable(alfa_1 ${SOURCE_FILES})
  </code></pre>
  
  <p>In <code>foo.c</code> I use <code>pow()</code> function from <code>math.h</code>, which I include in <code>foo.h</code>. And obviously <code>foo.h</code> is included in <code>foo.c</code>. In <code>bar.c</code> I have <code>main</code> that is doing nothing. Now, standard command line compilation like this</p>
  
  <pre><code>gcc -o bar bar.c bar.h foo.h foo.c -lm
  </code></pre>
  
  <p>works fine but building the project yields undefined reference to <code>pow</code>. As one can see I included <code>-lm</code> flag in <code>CmakeLists.txt</code> file, so I don't get why this linking part is not working here</p>