add_library() has to know the library type at configure-time - trying to change it with a generator expression won’t work. Try this instead:
if(MSVC)
set(_type STATIC)
else()
set(_type SHARED)
endif()
add_library(StdStars ${_type}
# sources here
)