I have been trying to set up GLFW to start an OpenGL project, but an error keeps appearing that I cannot get to solve, no matter what I try. The important part of the error message is the following :
CMake Error at CMakeLists.txt:12 (find_package):
Could not find a configuration file for package "glfw3" that is compatible
with requested version "3.3.2".
The following configuration files were considered but not accepted:
C:/Users/../GLFW/lib/cmake/glfw3/glfw3Config.cmake, version: 3.3.2 (32bit)
My CMakeLists.txt looks like this :
set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/Dependencies/GLFW/lib/cmake/glfw3")
add_executable(1_Intro main.cpp)
include_directories(Dependencies/GLFW/include/GLFW/)
find_package(glfw3 3.3.2 CONFIG REQUIRED)
target_link_libraries(1_Intro ${GLFW})
and all the necessary GLFW files can be found in my project's folder like so :
GLFW
|- include
| |- GLFW
| | - glfw3.h
| | - glfw3native.h
|- lib
|- cmake
|- glfw3
|- glfw3Config.cmake
|- glfw3ConfigVersion.cmake
|- glfw3Targets.cmake
|- glfw3Targets-noconfig.cmake
|- pkgconfig
|- glfw3.pc
|- libglfw3.a
What I did to build the library was downloading the source code, then using cmake -G "MinGW Makefiles"
as I use the MinGW-w64 GCC compiler, then mingw32-make
and mingw32-make install
. Then I copied the build files to the folder like shown above.
After searching for a solution, I found that the problem might come from a difference in the build architecture used by the library and the compiler (here and here). I use the MinGW-w64 compiler and would prefer to stick with it, so I tried changing the CMake build. However, I came across another problem, that I cannot change the platform specifications of "MinGW Makefiles" with options like -DCMAKE_GENERATOR_PLATFORM
. I tried changing the toolchain but that didn't work either; the only solution seems to be to use the Visual Studio 64 bits toolchain, but that's not what I want.
Is there a way to change my CMake build in such a way that it is a x64 architecture ? Or to set my compiler to x86 (if that even makes sense) to match the "glfw3Config.cmake" version ? I am open to other solutions, as long as I can keep my project structure and the compiler as they are.