Use GLFW with CLion and cygwin windows 10


#1

Hello,
I would use GLFW in my project but didn’t work.

As recommended, put thoses lines in CMake conf to compile glfw with the project

add_subdirectory(/cygdrive/c/Users/Soreth/CLionProjects/glfw-3.2.1/ glfw)
include_directories(/cygdrive/c/Users/Soreth/CLionProjects/glfw-3.2.1/include/)

target_link_libraries(myapp glfw ${GLFW_LIBRARIES})

but when I run my project I got the following error :

CMake Error at /cygdrive/c/Users/Soreth/.CLion2018.3/system/cygwin_cmake/share/cmake-3.13.0/Modules/FindX11.cmake:429 (message):
Could not find X11
Call Stack (most recent call first):
/cygdrive/c/Users/Soreth/CLionProjects/glfw-3.2.1/CMakeLists.txt:212 (find_package)

That’s weird since x11 is linux and I try to compile it under windows.
If someone know how to fix it I’ll be glad.


#2

If you want to compile GLFW for Windows the Microsoft Visual Studio C++ compiler is available free of charge (Community edition).

Cygwin provides a Linux like experience for development including an X Windows server. I can’t see the package xorg-dev needed for compiling GLFW on Linux distributions, but it’s possible that you might be able to build GLFW for Cygwin with other packages which are available.

Alternatively you can use Cygwin to build your application but use GLFW binaries build for Windows, I saw some notes on this here:
http://web.eecs.umich.edu/~sugih/courses/eecs487/glfw-howto/#cygwin

Once again though I would reiterate that developing for Windows using Visual Studio is a much more standard procedure.