cxxmodules: error with imported targets when generator is Visual Studio
On Windows with msvc.
building fmt from this branch: https://github.com/jcar87/fmt/tree/lcc/cmake-3.28-modules , and installing it with cmake --install
A consumer project like roughly like this, where find_package
finds the just created fmt
with imported targets:
cmake_minimum_required(VERSION 3.28)
project(consumer LANGUAGES CXX)
find_package(fmt REQUIRED)
add_executable(hello_world hello.cpp)
target_link_libraries(hello_world PRIVATE fmt::fmt)
With "Visual Studio" generator, generation fails with:
-- Configuring done (0.0s)
CMake Error in CMakeLists.txt:
Target "fmt__fmt@synth_ae9f5af397a4" has source file
C:/path/to/fmt/install/lib/cxx/miu/src/fmt.cc
in a "FILE_SET TYPE CXX_MODULES" but it is not scheduled for compilation.
CMake Error in CMakeLists.txt:
Target "fmt__fmt@synth_ae9f5af397a4" has source file
C:/path/to/fmt/install/lib/cxx/miu/src/fmt.cc
in a "FILE_SET TYPE CXX_MODULES" but it is not scheduled for compilation.
CMake Error in CMakeLists.txt:
Target "fmt__fmt@synth_ae9f5af397a4" has source file
C:/path/to/fmt/install/lib/cxx/miu/src/fmt.cc
in a "FILE_SET TYPE CXX_MODULES" but it is not scheduled for compilation.
CMake Error in CMakeLists.txt:
Target "fmt__fmt@synth_ae9f5af397a4" has source file
C:/path/to/fmt/install/lib/cxx/miu/src/fmt.cc
in a "FILE_SET TYPE CXX_MODULES" but it is not scheduled for compilation.
-- Generating done (0.2s)
CMake Generate step failed. Build files cannot be regenerated correctly.
The consumer project builds and runs fine when using the Ninja generator.