VS: C++20 Modules only generate intellisense information if file extension is .ixx
VS 2022 with cmake 3.24 with this exact configuration
cmake_minimum_required(VERSION 3.24)
project(testing-modules-project VERSION 0.1.0)
####
# Ack use of experimental features
set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046")
# Experimental Module support
set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
# This setup is MSVC-only for now
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
string(CONCAT CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE
"<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> <SOURCE> /nologo /TP"
" /showIncludes /scanDependencies <DYNDEP_FILE>"
" /Fo<OBJECT>")
set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_DEPFILE_FORMAT "msvc")
set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT "msvc")
set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG "@<MODULE_MAP_FILE>")
endif()
####
add_library(modules-library STATIC)
target_compile_features(modules-library PUBLIC cxx_std_20)
target_sources(
modules-library
PUBLIC
FILE_SET CXX_MODULES FILES
src/test-module.cpp
"src/test-ixx-module.ixx")
add_executable(testing-modules-project "src/main.cpp")
target_link_libraries(testing-modules-project PUBLIC modules-library)
VS Code with the latest release of cmake in the same project
Edited by Kirchesch