Skip to content

Commit

Permalink
cmake: Disable modules if clang-scan-deps is missing
Browse files Browse the repository at this point in the history
clang ships the clang-scan-deps tool separately from the compiler, making it possible
that the clang compiler supports modules but cannot be used by CMake for VulkanHppModule.

The straightforward solution is to, when using clang, check that the scan deps tools was
located. This prevents people who are using clang but not the modules from being unable
to use Vulkan-Headers when the clang-scan-deps tools is missing.
  • Loading branch information
charles-lunarg committed Jul 16, 2024
1 parent fc6c06a commit b379292
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ target_include_directories(Vulkan-Headers INTERFACE $<BUILD_INTERFACE:${CMAKE_CU

if (MSVC AND (MSVC_VERSION GREATER_EQUAL "1941") OR
# clang-cl doesn't currently support modules
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "16.0" AND (NOT CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "MSVC")) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "16.0"
AND (NOT CMAKE_C_COMPILER_FRONTEND_VARIANT MATCHES "MSVC")
AND (NOT CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS STREQUAL CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS-NOTFOUND)) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "14.0"))
set(COMPILER_SUPPORTS_CXX_MODULES TRUE)
endif()
Expand Down

0 comments on commit b379292

Please sign in to comment.