title: How to statically link Qt5 with CMake in CLion?
body: <p>I downloaded the sources of Qt and compiled it with <code>-static</code> flag into <code>/usr/local/Qt5_static/</code>. I created empty project and changed <code>CMakeLists.txt</code> like this:</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.6)
  project(Splines)
  
  set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -pedantic -static -stdlib=libc++ -lc++abi -v")
  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
  set(SOURCE_FILES main.cpp)
  
  set(CMAKE_AUTOMOC ON)
  set(CMAKE_INCLUDE_CURRENT_DIR ON)
  
  set(Qt5_DIR "/usr/local/Qt5_static/")
  find_package(Qt5Widgets)
  
  add_executable(Splines ${SOURCE_FILES})
  
  target_link_libraries(Splines Qt5::Widgets)
  </code></pre>
  
  <p>There is a linker error.</p>
  
  <pre><code>/usr/bin/ld: attempted static link of dynamic object `/usr/lib/libQt5Widgets.so.5.7.0'
  clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>Looks like linker tried to link shared lib instead of static lib i compiled. I tried other variations of CMakeLists.txt but failed.</p>
  
  <p>How to statically link Qt with cmake properly? 
  (Sorry for my bad english)</p>