[CMake] check_cxx_compiler_flag usage

Eric Noulard eric.noulard at gmail.com
Thu Dec 7 04:35:37 EST 2017


Not really answering the question but
did you try to use an existing CMake module for handling sanitizers config?

I find this one https://github.com/arsenm/sanitizers-cmake very effective,
with
modern CMake target oriented features.




2017-12-07 9:24 GMT+01:00 Damien R <damienrg+list at gmail.com>:

> Hi,
>
> I am trying to use CHECK_CXX_COMPILER_FLAG with cmake 3.9 to check if the
> compiler supports asan.
> The CMakeLists.txt is:
> cmake_minimum_required(VERSION 3.9)
> include(CheckCXXCompilerFlag)
> check_cxx_compiler_flag("-fsanitize=address" COMPILER_SUPPORT_FLAG)
>
> I always got:
> -- Performing Test COMPILER_SUPPORT_FLAG - Failed
>
> 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.
> Can you tell me why CHECK_CXX_COMPILER_FLAG use CMAKE_REQUIRED_DEFINITIONS instead
> of CMAKE_REQUIRED_FLAGS
> and what is the official way for checking this flag?
>
> Regards,
>
> Damien R.
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171207/2c224778/attachment.html>


More information about the CMake mailing list