Skip to content

Clang/Windows: Unsupported option '-fPIC' generated by CMake

I am using cmake version 3.24 on windows using the ninja generator and the clang compiler (15.0.1). The problem is that cmake adds the option -fPIC for clang, but clang complains that this option is not supported. CMake should not add this option for clang on windows (targeting windows?).

I understand that there is the option CMAKE_POSITION_INDEPENDENT_CODE to turn this off (even though it did not work for me), but in the described case it does not make sense to add the option -fPIC no matter what CMAKE_POSITION_INDEPENDET_CODE is set to.

So please ensure that this option is not added for clang on windows (targeting windows?).

Thanks and kind regards

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information