title: Linking GSL in CMakeLists.txt
body: <p>I have a code with multiple files, that uses the GSL Library. When I compile the code through the terminal with the command</p>
  
  <pre><code>g++ main.cpp -lm -lgsl -lgslcblas -o Exec
  </code></pre>
  
  <p>This compiles and gives the correct output and no errors.
  However, when I try and build the code in CLion I get the error </p>
  
  <pre><code>undefined reference to `gsl_rng_uniform'
  </code></pre>
  
  <p>I have linked the various .cpp files in my code through the CMakeLists.txt, but I think, I have to something similar to the flags to link to GSL.
  My CMakeLists.txt file is as follows currently (only the .cpp files are included in the source files, not the .h files):</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.7)
  project(Unitsv1)
  
  set(CMAKE_CXX_STANDARD 11)
  
  set(SOURCE_FILES main.cpp
                   transition.cpp
                   random.cpp)
  add_executable(Unitsv1 ${SOURCE_FILES})
  </code></pre>
  
  <p>I'm very new to C++, and can't seem to find any answers online.
  Thanks</p>