Override CMAKE_CXX_STANDARD at target level.

If you want the GNU extensions, please try the following:

set_property(TARGET foo PROPERTY CXX_STANDARD 14)
set_property(TARGET foo PROPERTY CXX_EXTENSIONS ON)

We generally try to avoid manually passing -std= flags - CMake prefers to handle this on its own.