Thanks for the explanation of how to solve the problem, that’s very helpful
I’ll give it a try.

Shouldn’t the variable be set to something like “FALSE” even if reporting
incorrectly when left blank? I appreciate the workaround but I believe
there is still a bug that would need to be addressed. Is this the right
place to report bugs or is it mainly for questions?

Thanks again!


Cheers!
Andrew Hundt

On Fri, Feb 26, 2016 at 2:57 PM, Gregor Jasny <gja...@googlemail.com> wrote:

> Hello,
>
> On 26/02/16 00:00, Andrew Hundt wrote:
> > 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 problem is not compiler path related but related to the additional
> warnings that are enabled:
>
>
> https://github.com/code-iai/iai_kinect2/blob/master/kinect2_calibration/CMakeLists.txt#L4
>
> > set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBT_USE_DOUBLE_PRECISION -Wall")
> > # Unused warnings
> > set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuninitialized -Winit-self
> -Wunused-function -Wunused-label -Wunused-variable
> -Wunused-but-set-variable -Wunused-but-set-parameter")
> > # Additional warnings
> > set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Warray-bounds -Wtype-limits
> -Wreturn-type -Wsequence-point -Wparentheses -Wmissing-braces
> -Wchar-subscripts -Wswitch -Wwrite-strings -Wenum-compare -Wempty-body
> -Wlogical-op")
>
> Those cause clang to emit a warning about unknown warnings:
>
> >  clang -c -DBT_USE_DOUBLE_PRECISION -Wall -Wuninitialized -Winit-self
> -Wunused-function -Wunused-label -Wunused-variable
> -Wunused-but-set-variable -Wunused-but-set-parameter -Warray-bounds
> -Wtype-limits -Wreturn-type -Wsequence-point -Wparentheses -Wmissing-braces
> -Wchar-subscripts -Wswitch -Wwrite-strings -Wenum-compare -Wempty-body
> foo.cpp
> > warning: unknown warning option '-Wunused-but-set-variable'; did you mean
> >       '-Wunused-const-variable'? [-Wunknown-warning-option]
> > warning: unknown warning option '-Wunused-but-set-parameter'; did you
> mean
> >       '-Wunused-parameter'? [-Wunknown-warning-option]
> > 2 warnings generated.
>
> Those warnings are interpreted by check_cxx_compiler_flag as failure
> (this is the regex you observed [1]) which leads to a negative setting
> of the variable.
>
> I see three possible solutions:
>
> 1) Move the check before touching the CMAKE_CXX_FLAGS.
> 2) Require a more modern CMake (3.3) and set
>   CMAKE_CXX_STANDARD to 11
>   CMAKE_CXX_STANDARD_REQUIRED to TRUE
> 3) Use modern CMake with target compile features:
>   https://cmake.org/cmake/help/v3.3/manual/cmake-compile-features.7.html
>
> Thanks,
> Gregor
>
> [1]
>
> https://github.com/Kitware/CMake/blob/master/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake#L25
>
>
>
-- 

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

Reply via email to