Like you pointed out in pull #313, it would be better to put this logic in one place and then append the resulting flags where needed. Having the logic just copy/pasted is a bad idea.

You may want to put this common logic in the top-level CMakeLists file, add the extra flags to a list and then append that list to CMAKE_CXX_FLAGS in both the YCM CMakeLists file and the BoostParts file. Or you could use some other approach you think would be better.