Seems like the headers visiblity is incorrect

cmake_minimum_required(VERSION 3.30)

project(Temp LANGUAGES CXX)

add_subdirectory("mylib")

add_executable(main "Main.cpp")
target_link_libraries(main PRIVATE Mylib::mylib)
add_library(mylib)
add_library(Mylib::mylib ALIAS mylib)

target_sources(mylib
    PUBLIC
    FILE_SET HEADERS
    BASE_DIRS "include"
    FILES
    "include/mylib/SayHello.hpp"

    PRIVATE
    "source/SayHello.cpp"
)

target_compile_features(mylib PUBLIC cxx_std_17)


The header file in mylib is intended to have public visibility.

However, in the solution properties, there is no Public directory listed, only Private ones.

In the generated .vcxproj file, “Public Headers” refers to interface-only headers, while “Private” (Additional Include Directories) corresponds to CMake’s internal or private includes. The conversion between CMake and Visual Studio should correctly map these include types so that other projects can link against this one without requiring manual adjustments to target or include properties.

In summary:
Public headers should map to both Additional Include Directories and Public Include Directories.
Private headers should map to Additional Include Directories only.
Interface headers should map to Public Include Directories only.