[CMake] cmake cannot add clang cxx flags

Rashad M mohammedrashadkm at gmail.com
Mon May 19 03:05:37 EDT 2014


Hi all,

I was trying to add a cxx flags to clang -Wno-#warnings. to supress a
deprecated header warning.

In file included from main.cxx:3:
/opt/install/vcl/vcl_deprecated_header.h:10:3: warning: "deprecated"
[-W#warnings]
# warning "deprecated"

when i compile from terminal.

clang++ main.cxx -I/opt/install/vcl/include/ -Wno-#warnings

gives me no warning and error.

but I cannot set this cxx flags on cmake neither by ccmake nor by cmake
-DCMAKE_CXX_FLAGS

The cmake error is throwing up on configure saying compiler of test program
failed.


  Building CXX object
  CMakeFiles/cmTryCompileExec1599991946.dir/TestGDALHasOGR.cxx.o

  /usr/bin/clang++ -Wno- -o
  CMakeFiles/cmTryCompileExec1599991946.dir/TestGDALHasOGR.cxx.o -c
  /home/otbtesting/OTB/trunk/OTB/CMake/TestGDALHasOGR.cxx

  /home/otbtesting/OTB/trunk/OTB/CMake/TestGDALHasOGR.cxx:4:10: fatal error:
  'ogrsf_frmts.h' file not found

It is clear that -Wno-#warning is not parsed properly. This maybe due to
clang warning flag starting with # symbol.

Is there any way to add this flag to cmake.

I am using Fedora 20 x86_64
cmake --version
cmake version 2.8.12.2

-- 
Regards,
   Rashad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140519/a3d9160e/attachment-0001.html>


More information about the CMake mailing list