<div dir="ltr">Sorry I got confused in what you were trying to say.<br>
It indeed seems to be an error, as checking if a compiler supports some defines does not make sense. Might be that an error occurred when COMPILE_FLAGS became COMPILE_OPTIONS or something. </div><div dir="ltr">I would suggest opening an issue on cmake gitlab about it. (I also added the cmake-dev list to cc)  </div><div dir="ltr"><br></div><div dir="ltr">However, it does indeed work for me, the script I linked before really tries to use the - -coverage, and fails accordingly when using msvc, and works with GCC. It wouldn't surprise me if cmake had some fallback when detecting options in the definition variable. </div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">I still think that checking the CMakeError.log to see what command is used for the test in your case would be interesting to know what really happens in your case. </div><div dir="ltr"><br></div><span></span>Regards, <div>Lectem. </div><div><br><div class="gmail_quote"><div dir="ltr">Le jeu. 7 déc. 2017 à 22:04, Damien R <<a href="mailto:damienrg%2Blist@gmail.com" target="_blank">damienrg+list@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>check_cxx_compiler_flag uses CMAKE_REQUIRED_DEFINITIONS. For me its means that only "-DSOME_FLAG=VALUE" should be tested with this macro and I think that the name is misleading.<br>Some people define CMAKE_REQUIRED_FLAGS / CMAKE_REQUIRED_LIBRARIES before invoking check_cxx_compiler_flag but I think that they should use check_cxx_source_compiles.<br>In your case I would use CMAKE_REQUIRED_FLAGS and check_cxx_source_compiles.<br></div><div><br></div><div>But as I am not the developer which has written this cmake code there may be some points that invalidate what I just said.</div><div><br></div><div>Regards,</div><div><br></div><div>Damien R.<br></div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 7 December 2017 at 15:13, Clément Gregoire <span dir="ltr"><<a href="mailto:lectem@gmail.com" target="_blank">lectem@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Your usage of check_cxx_compiler_flag is correct, it's probably just missing link flags or something.</div><div>Can you check the error log of cmake to know why it fails to compile ? It is in your buildfolder : CMakeFiles/CMakeError.log<br></div><div></div><div><br></div>Here's how I did it for coverage by the way (not perfect, but was enough for my usage):<br><br><a href="https://github.com/Lectem/cpp-boilerplate/blob/master/cmake/Coverage.cmake#L42" target="_blank">https://github.com/Lectem/cpp-boilerplate/blob/master/cmake/Coverage.cmake#L42</a><br><br><br><div><br></div></div><div class="m_4931090767145763741m_6802727632295156256HOEnZb"><div class="m_4931090767145763741m_6802727632295156256h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-12-07 14:31 GMT+01:00 Damien R <span dir="ltr"><<a href="mailto:damienrg+list@gmail.com" target="_blank">damienrg+list@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thank you for pointing that. It increments the number of people using CMAKE_REQUIRED_FLAGS "trick" to make it working with check_cxx_compiler_flag.</div><div><br></div><div>But my question is more about :</div><div> - why they coded <span style="font-size:12.8px">CHECK_CXX_COMPILER_FLAG this way?</span></div><div><span style="font-size:12.8px"> - is my usage valid or not? If not what should I do? If yes, is it a bug?</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Regards,</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Damien R.</span></div><div><br></div><div><br></div></div><div class="m_4931090767145763741m_6802727632295156256m_-7884858041568299102HOEnZb"><div class="m_4931090767145763741m_6802727632295156256m_-7884858041568299102h5"><div class="gmail_extra"><br><div class="gmail_quote">On 7 December 2017 at 10:35, Eric Noulard <span dir="ltr"><<a href="mailto:eric.noulard@gmail.com" target="_blank">eric.noulard@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>Not really answering the question but </div>did you try to use an existing CMake module for handling sanitizers config?<div><br></div><div>I find this one <a href="https://github.com/arsenm/sanitizers-cmake" target="_blank">https://github.com/arsenm/sanitizers-cmake</a> very effective, with</div><div>modern CMake target oriented features.</div><div><div><br></div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_4931090767145763741m_6802727632295156256m_-7884858041568299102m_3126175452924230299h5">2017-12-07 9:24 GMT+01:00 Damien R <span dir="ltr"><<a href="mailto:damienrg+list@gmail.com" target="_blank">damienrg+list@gmail.com</a>></span>:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_4931090767145763741m_6802727632295156256m_-7884858041568299102m_3126175452924230299h5"><div dir="ltr">Hi,<div><br></div><div>I am trying to use CHECK_CXX_COMPILER_FLAG with cmake 3.9 to check if the compiler supports asan.</div><div>The CMakeLists.txt is:</div><div><div>cmake_minimum_required(VERSION 3.9)</div><div>include(CheckCXXCompilerFlag)</div><div>check_cxx_compiler_flag("-fsanitize=address" COMPILER_SUPPORT_FLAG)</div></div><div><br></div><div>I always got:</div><div>-- Performing Test COMPILER_SUPPORT_FLAG - Failed<br></div><div><br></div><div>Even if the documentation say that CHECK_CXX_COMPILER_FLAG sets CMAKE_REQUIRED_DEFINITIONS by the name of the macro I thought that it would work.</div><div>Can you tell me why CHECK_CXX_COMPILER_FLAG use CMAKE_REQUIRED_DEFINITIONS instead of CMAKE_REQUIRED_FLAGS</div><div>and what is the official way for checking this flag?</div><div><br></div><div>Regards,</div><div><br></div><div>Damien R.</div><div><br></div></div>
<br></div></div><span>--<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="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></span></blockquote></div><span class="m_4931090767145763741m_6802727632295156256m_-7884858041568299102m_3126175452924230299HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_4931090767145763741m_6802727632295156256m_-7884858041568299102m_3126175452924230299m_-6825609029323555215gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Eric<br></div></div></div></div></div>
</font></span></div>
</blockquote></div><br></div>
</div></div><br>--<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="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</blockquote></div></div>