Only add -F if the frameworks folder exists

Closes #16901.