Exposing BUILD_SHARED_LIBS via option?

I have a best practices question. I read in the documentation regarding BUILD_SHARED_LIBS:
https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html

This documentation contains the following passage:

This variable is often added to projects as an option() so that each user of a project can decide if they want to build the project using shared or static libraries.

But exposing that variable as an option will affect all dependent cmake projects as well, which might interfere with these projects. Thus, shouldn’t it be considered bad practice to expose the BUILD_SHARED_LIBS as an option?

I always use LIBNAME_BUILD_SHARED_LIBS or PROJECTNAME_BUILD_SHARED_LIBS instead to avoid leaking as you mention.

Do you at the same time link your project prefixed version with the global version?

No. But I don’t know what’s best practice either, I just started doing it once I added a project that had BUILD_SHARED_LIBS as an option and it turned my statically linked project into a bunch of .dll out of nowhere. :sweat_smile: