<div dir="ltr">The best approach is to use properties (see <a href="https://cmake.org/cmake/help/git-master/manual/cmake-properties.7.html">https://cmake.org/cmake/help/git-master/manual/cmake-properties.7.html</a>).<div><br></div><div>At directory level and target level you can use property 'COMPILE_OPTIONS'.  These properties can be updated using, respectively 'add_compile_options' and 'target_compile_options'.</div><div><br></div><div>Be aware that variable 'CMAKE_CXX_FLAGS' is a string so to extend it you have to use:</div><div>string(APPEND CMAKE_CXX_FLAGS "flag1 flag2")</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">Le mar. 11 sept. 2018 à 17:58, Michael Jackson <<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="#0563C1" vlink="#954F72"><div class="m_-3039706979732659771WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt">What is the “modern” way to append to CMAKE_CXX_FLAGS? This is the logic that I would like:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt">If (MSVC)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt">                Set(CMAKE_CXX_FLAGS ${ CMAKE_CXX_FLAGS} “/MP”)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt">Endif()<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt">I have always heard that appending to the compile flags in this way is “bad”. What is the best practice for doing this?<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt">Thanks<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:black">--<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:black">Michael Jackson | Owner, President<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:black">      BlueQuartz Software<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:black">[e] <a href="mailto:mike.jackson@bluequartz.net" target="_blank"><span style="color:purple">mike.jackson@bluequartz.net</span></a><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:black">[w] <a href="http://www.bluequartz.net" target="_blank"><span style="color:#0563c1">www.bluequartz.net</span></a></span><u></u><u></u></p></div></div>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div>