xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
9.8k stars 772 forks source link

When using only C++20 modules, CMake project generator creates invalid CMakeLists #3003

Open DatCaptainHorse opened 1 year ago

DatCaptainHorse commented 1 year ago

Xmake Version

2.7.2

Operating System Version and Architecture

Windows 11 Pro 22H2 (22621.674)

Describe Bug

In a project that uses only C++20 modules, the CMake project generator creates CMakeLists.txt with empty target_sources, which results in No SOURCES given to targe: XYZ errors.

image

Expected Behavior

I'm expecting CMake project generator to fill target_sources with source .mpp files. This allows for IDE to use the CMakeLists file for proper syntax highlighting and other features.

Project Configuration

No response

Additional Information and Error Logs

No response

waruqi commented 1 year ago

I'm expecting CMake project generator to fill target_sources with source .mpp files. This allows for IDE to use the CMakeLists file for proper syntax highlighting and other features.

cmake now only supports the module for msvc, as a result, xmake can currently only make cmake support modules by generating custom commands. The generated cmakelists.txt should be able to support gcc/clang/msvc.

Of course, for msvc, we could really improve the generated results using target_sources, but I don't have time to improve it at the moment.