I found that the generated printing of the library is inconsistent, so I am here to ask.
[main] 正在配置项目: vulkan
[proc] 正在执行命令: E:\mysoftware\cmake-4.2.0-rc2-windows-x86_64\bin\cmake.EXE -DCMAKE_INSTALL_PREFIX=E:/0_github_project/vulkan/install/ -DCMAKE_C_COMPILER=E:/mysoftware/llvm-mingw-20250910-ucrt-x86_64/bin/gcc.exe -DCMAKE_CXX_COMPILER=E:/mysoftware/llvm-mingw-20250910-ucrt-x86_64/bin/g++.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=D:/mysoftware/ninja/ninja.exe -S E:/0_github_project/vulkan -B E:/0_github_project/vulkan/build -G Ninja
[cmake] -- The CXX compiler identification is Clang 21.1.1
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: E:/mysoftware/llvm-mingw-20250910-ucrt-x86_64/bin/g++.exe - skipped
[cmake] -- Detecting CXX compile features
[cmake] CMake Warning (dev) at E:/mysoftware/cmake-4.2.0-rc2-windows-x86_64/share/cmake-4.2/Modules/Compiler/CMakeCommonCompilerMacros.cmake:248 (cmake_language):
[cmake] CMake's support for `import std;` in C++23 and newer is experimental. It
[cmake] is meant only for experimentation and feedback to CMake developers.
[cmake] Call Stack (most recent call first):
[cmake] E:/mysoftware/cmake-4.2.0-rc2-windows-x86_64/share/cmake-4.2/Modules/CMakeDetermineCompilerSupport.cmake:113 (cmake_create_cxx_import_std)
[cmake] E:/mysoftware/cmake-4.2.0-rc2-windows-x86_64/share/cmake-4.2/Modules/CMakeTestCXXCompiler.cmake:83 (CMAKE_DETERMINE_COMPILER_SUPPORT)
[cmake] CMakeLists.txt:14 (project)
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[proc] 正在执行命令: E:\mysoftware\cmake-4.2.0-rc2-windows-x86_64\bin\cmake.EXE --build E:/0_github_project/vulkan/build --target base --
[build] [1/14] Scanning E:/0_github_project/vulkan/test/base/base.cpp for CXX dependencies
[build] [2/14] Scanning E:/mysoftware/llvm-mingw-20250910-ucrt-x86_64/share/libc++/v1/std.compat.cppm for CXX dependencies
[build] [3/14] Scanning E:/mysoftware/VulkanSDK/1.4.321.1/Include/vulkan/vulkan.cppm for CXX dependencies
[build] [4/14] Scanning E:/mysoftware/llvm-mingw-20250910-ucrt-x86_64/share/libc++/v1/std.cppm for CXX dependencies
[build] [5/14] Generating CXX dyndep file CMakeFiles/__cmake_cxx23.dir/CXX.dd
[build] [6/14] Generating CXX dyndep file CMakeFiles/vulkan_modules.dir/CXX.dd
[build] [7/14] Generating CXX dyndep file CMakeFiles/base.dir/CXX.dd
[build] [8/14] Building CXX object CMakeFiles/__cmake_cxx23.dir/E_/mysoftware/llvm-mingw-20250910-ucrt-x86_64/share/libc++/v1/std.cppm.obj
[build] [9/14] Building CXX object CMakeFiles/__cmake_cxx23.dir/E_/mysoftware/llvm-mingw-20250910-ucrt-x86_64/share/libc++/v1/std.compat.cppm.obj
[build] [10/14] Linking CXX static library lib__cmake_cxx23.a
[build] [11/14] Building CXX object CMakeFiles/vulkan_modules.dir/E_/mysoftware/VulkanSDK/1.4.321.1/Include/vulkan/vulkan.cppm.obj
[build] [12/14] Linking CXX static library libvulkan_modules.a
[build] [13/14] Building CXX object CMakeFiles/base.dir/test/base/base.cpp.obj
[build] [14/14] Linking CXX executable base.exe
[driver] 生成完毕: 00:00:13.497
My configuration is as follows
set(VULKAN_SDK_DIR "E:/mysoftware/VulkanSDK/1.4.321.1")
add_library(vulkan_modules STATIC)
target_sources(vulkan_modules
PUBLIC
FILE_SET CXX_MODULES
BASE_DIRS ${VULKAN_SDK_DIR}
FILES
"${VULKAN_SDK_DIR}/Include/vulkan/vulkan.cppm"
)
target_include_directories(vulkan_modules
PUBLIC
"${VULKAN_SDK_DIR}/Include"
)
target_compile_features(vulkan_modules PRIVATE cxx_std_23)
# config vulkan
target_compile_definitions(vulkan_modules PUBLIC -DUSE_CPP20_MODULES -DVULKAN_HPP_NO_STRUCT_CONSTRUCTORS)
# for <cstdlib>
target_compile_definitions(vulkan_modules PUBLIC EXIT_SUCCESS=0 EXIT_FAILURE=1)
unset(VULKAN_SDK_DIR)
Everything is normal and running without any issues. The difference is that the ability to integrate clangd is too poor. I found that importing std; It will not cause clangd to crash, but import vulkan_hpp; Easy to cause clangd to crash. Compile_commands.json is the core key, all of which are directly imported as xxx; Why can’t vulkan_hpp compare to std? We know that std is a pure template library that is theoretically much more difficult to recognize than vulkanxpp, but the results were unexpected.