cmake: eliminate duplicate installation of public headers (cherry picked from commit 5fe83d7433022e29a401753f64ec78faaf25e0a7)