Must I install Vulkan SDK before I build an OpengGL project with GLFW source file?

In the compiled document, I see that if you don’t use Vulkan test or example program then you can compile glfw without Vulkan SDK. I can compile it collectly. However, when I try to build a cross-platform OpenGL program with GLFW supporting, while Vulkan is not used, my cmake config goes into error: Could NOT find Vulkan (missing: VULKAN_LIBRARY VULKAN_INCLUDE_DIR).

All I find on google is that you need to install Vulkan SDK and set the link collectively. However, I don’t need Vulkan in my program, so I want to confirm whether I must install Vulkan SDK before I build a not Vulkan related program with the glfw source file.

The GLFW part of my CMakeLists.txt is below:

# config glfw
set( GLFW_BUILD_EXAMPLES OFF CACHE BOOL  "GLFW lib only" )
set( GLFW_BUILD_TESTS OFF CACHE BOOL  "GLFW lib only" )
set( GLFW_BUILD_DOCS OFF CACHE BOOL  "GLFW lib only" )
set( GLFW_BUILD_INSTALL OFF CACHE BOOL  "GLFW lib only" )

add_subdirectory(3rd_party/glfw)
include_directories(3rd_party/glfw/include)
LIST(APPEND LIBS glfw ${GLFW_LIBRARIES})

I’m new in Cmake, maybe I miss sth important? Thx in advance.

Could you put the actual error message here? I’ve seen cmake output a warning that vulkan was missing but it didn’t cause an issue with generating project/make files.

In other words cmake will detect that the vulkan SDK is not installed, but GLFW will still be usable for OpenGL, just not for Vulkan.

2 Likes

Thanks a lot!
After reading your post I checked my CMakeLists.txt carefully and finally I found that the error is not caused by GLFW.
I am so sorry that it waste your precious time.

No problem and happy coding :slight_smile: