Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in CMakeLists when using c++20 modules #4087

Open
gibberishCode opened this issue Aug 16, 2023 · 3 comments
Open

Errors in CMakeLists when using c++20 modules #4087

gibberishCode opened this issue Aug 16, 2023 · 3 comments

Comments

@gibberishCode
Copy link

gibberishCode commented Aug 16, 2023

Xmake Version

v2.8.1+master.beafb2d5c

Operating System Version and Architecture

Ubuntu 22.04.3 LTS

Describe Bug

When generating CMakeLists while using c++ 20 modules with gcc-13
The part in cmake responsible for compiling modules will not set appropriate flags, and will not propagate target flags like -g.

Expected Behavior

Correctly set flags

Project Configuration

add_rules("mode.debug", "mode.release")

target("modules_test")
    set_kind("binary")
    set_languages("c++23")
    add_cxxflags("gcc::-fmodules-ts")
    add_files("src/*.cpp", "src/*.ixx")
    add_files("engine/*.ixx")

I use gcc-13

Additional Information and Error Logs

Example of an error
note: C++20 ‘module’ only available with ‘-fmodules-ts’
warning: keyword ‘export’ is deprecated, and is ignored

I fixed it in my local copy of xmake with very dirty hack like so
This from cmakelists.lua 96x lines
`
for _, cmd in ipairs(cmds) do

        local command = _get_command_string(cmd, outputdir)
        
        if command then
        
            if string.find(command, "g++") then
            
                cmakelists:print("    COMMAND %s -fmodules-ts", command)
                
            else
            
                cmakelists:print("    COMMAND %s ", command)
                
            end
        end
    end

`

@waruqi
Copy link
Member

waruqi commented Aug 17, 2023

duplicate. see #3642

@gibberishCode
Copy link
Author

Okay so for now use Vs code and compile commands + clanagd
Cmake generation is not supported yet

@waruqi
Copy link
Member

waruqi commented Feb 19, 2024

try it again. xmake update -s dev #4746

and please update cmake to >= 3.28.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants