title: GLFW3 library in CLion with CMake causes undefined symbols on MacOS
body: <p>I built GLFW from source in MacOS using cmake, and everything went well, the examples are working. But when I was trying to compile a program using cmake in clion, I got the following error:</p>
  
  <pre><code>Scanning dependencies of target triangle
  [ 50%] Building CXX object CMakeFiles/triangle.dir/main.cpp.o
  [100%] Linking CXX executable triangle
  Undefined symbols for architecture x86_64:
    "_CFArrayAppendValue", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
    "_CFArrayCreateMutable", referenced from:
      __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
      _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  ... (There are a huge bunch of errors like this, let me know if you want to read all of them)
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make[3]: *** [triangle] Error 1
  make[2]: *** [CMakeFiles/triangle.dir/all] Error 2
  make[1]: *** [CMakeFiles/triangle.dir/rule] Error 2
  make: *** [triangle] Error 2
  </code></pre>
  
  <p>I browsed through the internet and the documentation and found that I should compile with framework arguments, like this: </p>
  
  <pre><code>cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo
  </code></pre>
  
  <p>I tried it on the command line, it worked. But what if I want to have things done in CLion(or CMake?) Or how can I use framework in CMake?</p>
  
  <p>My CMakeLists.txt in case you want to know: </p>
  
  <pre><code>cmake_minimum_required(VERSION 3.8)
  project(triangle)
  
  set(CMAKE_CXX_STANDARD 11)
  find_package(glfw3 REQUIRED)
  
  set(SOURCE_FILES main.cpp)
  add_executable(triangle ${SOURCE_FILES})
  target_link_libraries(triangle glfw3)
  </code></pre>