Create Library project in CLion

PlatformIO has no built-in capability to only compile a library (to e.g. a static .a library file) – it must always be done in the context of a sketch / project (then a static library is also a side product, see e.g. How to generate and use pre-compiled objects). As linked, pio ci is basically a shortcut way of compiling a sketch given only the library folder itself and a test sketch file, and that can only be accessed from the commandline, not via any CLion or PlatformIO build target. PlatformIO mainly thinks in projects.

I think you will find it much easier to develop a library if you just create a normal project for your target board / architecture (can also be multiple [env:xyz]), create your library in a new folder in the lib/ folder of the project and develop and test it from there, then pull out the final library folder as the result.