CMake does support attached sources files with INTERFACE libraries at the very least starting with 3.19, which is 5 years old at this point. But this is a red herring anyway, you do not need source files for basic linting (you do for go-to-implementation and such features). You only need the header files, and you need those anyway because without them your project won't compile.The documentation for CMake says that INTERFACE libraries have no source code, so it wouldn't make sense for CLion to lint source files on such a project.
Most of the pico sdk is actually implemented in C, just a few things that need to be are in (inline) assembly. I'm not familiar enough with the intricacies of cmake to predict exactly what would happen if you set it to STATIC, but I'd expect that you'd end up with duplicate functions in the final executable (or worse link conflicts) if you do that.Some of the libraries on the community sticky post are STATIC (even though it says that only INTERFACE libraries will be accepted), so I'm inclined to believe that I could just change the project type to STATIC. I tried reading some of the Pico SDK source code, and it seems that it's all header files, with implementations in assembly I presume, and so an INTERFACE library would make more sense in that case, but not necessarily for all use cases.
But none of that should matter at all for linting. I have never used Clion so I have no idea what the actual issue it's having is, but arbitrarily changing CMake rules to make it happy seems like the opposite of creating a "proper" library.
Statistics: Posted by Tharre — Wed Jul 09, 2025 8:45 pm