title: How to correctly setup cmake for glfw on clion on MacOS
body: <p>I've recently bought a Macbook and I want to start writing some OpenGL code for a project.</p>
  <p>SPECIFICATIONS</p>
  <ul>
  <li>MacOS</li>
  <li>Macbook pro 16inch 2019</li>
  <li>Clion</li>
  <li>glfw3 (precompiled binaries 64 bit)</li>
  </ul>
  <p>The CMake doesn't complain, but as soon as I start compiling I get the following error</p>
  <pre><code>    /Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/arnesix/Documents/dev/c++/graphics/cmake-build-debug --target graphics -- -j 12
  [ 50%] Linking CXX executable graphics
  Undefined symbols for architecture x86_64:
    &quot;_CFArrayAppendValue&quot;, referenced from:
        __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
        _matchCallback in libglfw3.a(cocoa_joystick.m.o)
    &quot;_CFArrayCreateMutable&quot;, referenced from:
        __glfwInitJoysticksNS in libglfw3.a(cocoa_joystick.m.o)
        _matchCallback in libglfw3.a(cocoa_joystick.m.o)
    &quot;_CFArrayGetCount&quot;, referenced from:
        __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
        __glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
        _matchCallback in libglfw3.a(cocoa_joystick.m.o)
        _closeJoystick in libglfw3.a(cocoa_joystick.m.o)
        __glfwPlatformPollJoystick in libglfw3.a(cocoa_joystick.m.o)
    &quot;_CFArrayGetValueAtIndex&quot;, referenced from:
        __glfwSetVideoModeNS in libglfw3.a(cocoa_monitor.m.o)
        __glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
        _matchCallback in libglfw3.a(cocoa_joystick.m.o)
        _closeJoystick in libglfw3.a(cocoa_joystick.m.o)
        __glfwPlatformPollJoystick in libglfw3.a(cocoa_joystick.m.o)
    &quot;_CFArraySortValues&quot;, referenced from:
        _matchCallback in libglfw3.a(cocoa_joystick.m.o)
  </code></pre>
  <p>The binaries I have downloaded from <a href="https://www.glfw.org/download.html" rel="nofollow noreferrer">https://www.glfw.org/download.html</a> only contain the 64 bit binaries.</p>
  <p>I am using the following cmake code and folder structure
  <a href="https://i.stack.imgur.com/l3vZr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l3vZr.png" alt="enter image description here" /></a></p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;glfw3.h&gt;
  
  int main() {
      std::cout &lt;&lt; glfwInit() &lt;&lt; std::endl;
      return 0;
  }
  
  </code></pre>
  <p>and lastly, my Cmake preferences</p>
  <p><a href="https://i.stack.imgur.com/2gUTk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2gUTk.png" alt="enter image description here" /></a></p>
  <p>I would love to know why this keeps happening and how I should resolve this issue.</p>