title: CMake build static executable file
body: <p>I want to build an executable that includes all of libs that I used (opencv, dlib) so it can work on any computer.
  Here is my current CMakeList.txt</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.5.1)
  project(adc_fr)
  
  set(CMAKE_CXX_STANDARD 14)
  
  add_subdirectory(/media/sf_dlib-19.9/dlib dlib_build)
  
  FIND_PACKAGE(OpenCV REQUIRED)
  
  set(SOURCE_FILES
          FDetect.cpp
          FDetect.h
          FExtract.cpp
          FExtract.h
          main.cpp
          )
  
  add_executable(adc_fr ${SOURCE_FILES})
  set_target_properties(adc_fr PROPERTIES LINK_FLAGS "-static")
  
  target_link_libraries(adc_fr
          ${OpenCV_LIBS}
          dlib
          )
  </code></pre>
  
  <p>Here is the error I got when linking</p>
  
  <pre><code>/usr/bin/ld: attempted static link of dynamic object `/usr/lib/x86_64-linux-gnu/libwebp.so'
  collect2: error: ld returned 1 exit status
  CMakeFiles/adc_fr.dir/build.make:409: recipe for target 'adc_fr' failed
  make[2]: *** [adc_fr] Error 1
  CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/adc_fr.dir/all' failed
  make[1]: *** [CMakeFiles/adc_fr.dir/all] Error 2
  Makefile:83: recipe for target 'all' failed
  make: *** [all] Error 2
  </code></pre>
  
  <p>I do have <code>libwebp.a</code> available in <code>/usr/lib/x86_64-linux-gnu/</code></p>
  
  <p>How can I force to use static <code>libwebp.a</code> instead of <code>libwebp.so</code>?</p>
  
  <p>I did try to add <code>#SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")</code> but it still gave the same error.</p>
  
  <p>Much appreciated!</p>