[CMake] check_cxx_compiler_flag fails silently for complex compiler paths

Andrew Hundt athundt at gmail.com
Thu Feb 25 18:00:04 EST 2016


I believe check_cxx_compiler_flags is failing due to a long/complicated
compiler path.

Specifically my compiler is set to:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++

CMake version: 3.4.3

Full trace output in gist where you can see lines warning of regex failure:
https://gist.github.com/ahundt/88ce65bcc3c268acdd94


Here is the code snippet that fails:

include(CheckCXXCompilerFlag)
> check_cxx_compiler_flag(-std=c++11 COMPILER_SUPPORTS_CXX11)
> check_cxx_compiler_flag(-std=c++0x COMPILER_SUPPORTS_CXX0X)
> message(STATUS <<<<<<<<COMPILER_SUPPORTS_CXX11:${COMPILER_SUPPORTS_CXX11})


The above STATUS printout will be as if nothing was done that would set the
variable COMPILER_SUPPORTS_CXX11. In other words it is empty.

Here is the end of the trace:

> /usr/local/Cellar/cmake/3.4.3/share/cmake/Modules/CheckCXXCompilerFlag.cmake(62):
>  set(CMAKE_REQUIRED_DEFINITIONS ${{SAFE_CMAKE_REQUIRED_DEFINITIONS}} )
> /Users/athundt/source/costar_ws/src/iai_kinect2/kinect2_registration/CMakeLists.txt(14):
>  message(STATUS
> <<<<<<<<COMPILER_SUPPORTS_CXX11:${{COMPILER_SUPPORTS_CXX11}} )
> -- <<<<<<<<COMPILER_SUPPORTS_CXX11:
> /Users/athundt/source/costar_ws/src/iai_kinect2/kinect2_registration/CMakeLists.txt(15):
>  IF(COMPILER_SUPPORTS_CXX11 )
> /Users/athundt/source/costar_ws/src/iai_kinect2/kinect2_registration/CMakeLists.txt(17):
>  ELSEIF(COMPILER_SUPPORTS_CXX0X )
> /Users/athundt/source/costar_ws/src/iai_kinect2/kinect2_registration/CMakeLists.txt(19):
>  ELSE()
> /Users/athundt/source/costar_ws/src/iai_kinect2/kinect2_registration/CMakeLists.txt(20):
>  MESSAGE(FATAL_ERROR The compiler ${{CMAKE_CXX_COMPILER}} has no C++11
> support. Please use a different C++ compiler. )
> CMake Error at CMakeLists.txt:20 (MESSAGE):
>   The compiler
>
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
>   has no C++11 support.  Please use a different C++ compiler.
>
> -- Configuring incomplete, errors occurred!



Cheers!
Andrew Hundt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160225/069cb539/attachment.html>


More information about the CMake mailing list