CMakeSettings.json in repository may conflict with user settings
In order to compile on my windows system I had to regenerate the CMakeSettings.json file, in my case the path to llvm libraries was wrong. I don't think you need to provide it, it seems the commit to add MSVC compatibility doesn't need the cmakeCommandArgs line to be filled. I could be wrong.
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": []
}
]
}
Here for example is how my settings file looks after MSVC recreated it. I added the "-v", not sure that it makes much difference, but it might be a step to note for people opening the project directly in MSVC.
I didn't commit this one actually and I don't know if it's necessary. What happens if you remove it entirely?
I'm not sure that MSVC lets you do anything without the CMakeSettings.json file, deleting it and trying to manage anything related to cmake has it generate:
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
}
]
}
It seems functional, I'm not familiar with what "-v" does still. It looks like so long as LLVM and LLD libraries can be found with find_library in cmake it should just work?
The thing is that "Ninja" as a generator isn't even the one used with the recommended MSVC build, so it seems like this one is completely wrong?
I'm not exactly an expert in cmake config files, at least on my end opening the directory in MSVC (without the .json file) works. At this point I'm struggling with c3c's default project from c3c init which seemingly has some wildcard folder for libraries, but does not appear to handle wildcards.
Error reading project.c3p: invalid library target 'lib/**'.
Change it to "libs": [], this issue was fixed recently and creating a project with c3c init with the latest version of the compiler should be correct.
Tried a few more configurations, it seems when I switched to x64-clang-release cmake complained about the missing setting. The same cmake code which finds the llvm libraries for msvc might work when using clang specifically instead.
I'll accept pull requests to improve this if needed.