<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 18-May-15 06:50, Paul Smith wrote:<br>
    </div>
    <blockquote cite="mid:1431924624.22116.99.camel@mad-scientist.net"
      type="cite">
      <pre wrap="">On Sun, 2015-05-17 at 14:43 +0200, Ruslan Baratov via CMake wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">As far as I know extra flags set by Xcode itself. You can use 
XCODE_ATTRIBUTE_* target properties to enable/disable warnings. This 
table can be helpful: 
<a class="moz-txt-link-freetext" href="https://github.com/ruslo/leathers/wiki/List#xcodeclang-table">https://github.com/ruslo/leathers/wiki/List#xcodeclang-table</a>
</pre>
      </blockquote>
      <pre wrap="">
Thanks for your reply... but I don't quite understand what this table is
telling me.</pre>
    </blockquote>
    This table tells you what attribute you need to set to
    disable/enable specific warning.<br>
    E.g.:<br>
    <blockquote>
      <pre>| Clang           | Xcode                      |</pre>
      <pre>+-----------------+----------------------------+</pre>
      <pre>| enum-conversion | CLANG_WARN_ENUM_CONVERSION |</pre>
    </blockquote>
    <br>
    Makefile generator:<br>
    <blockquote>> cat CMakeLists.txt<br>
      cmake_minimum_required(VERSION 3.0)<br>
      project(Foo)<br>
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wenum-conversion")<br>
      add_library(foo foo.cpp)<br>
      <br>
      > cmake -H. -B_builds "-GUnix Makefiles"
      -DCMAKE_VERBOSE_MAKEFILE=ON<br>
      > cmake --build _builds<br>
      /.../usr/bin/c++ -Wenum-conversion ...<br>
    </blockquote>
    <br>
    Xcode generator (default):<br>
    <blockquote>> cat CMakeLists.txt<br>
      cmake_minimum_required(VERSION 3.0)<br>
      project(Foo)<br>
      add_library(foo foo.cpp)<br>
      <br>
      > cmake -H. -B_builds -GXcode<br>
      > cmake --build _builds<br>
      /.../usr/bin/clang ... -Wno-enum-conversion ...<br>
    </blockquote>
    Xcode generator (enable):<br>
    <blockquote>> cat CMakeLists.txt<br>
      cmake_minimum_required(VERSION 3.0)<br>
      project(Foo)<br>
      add_library(foo foo.cpp)<br>
      <br>
      set_target_properties(<br>
          foo<br>
          PROPERTIES<br>
          XCODE_ATTRIBUTE_CLANG_WARN_ENUM_CONVERSION YES<br>
      )<br>
      <br>
      > cmake -H. -B_builds -GXcode<br>
      > cmake --build _builds<br>
      /.../usr/bin/clang ... -Wenum-conversion ...<br>
    </blockquote>
    Xcode generator (disable):<br>
    <blockquote>> cat CMakeLists.txt<br>
      cmake_minimum_required(VERSION 3.0)<br>
      project(Foo)<br>
      add_library(foo foo.cpp)<br>
      <br>
      set_target_properties(<br>
          foo<br>
          PROPERTIES<br>
          XCODE_ATTRIBUTE_CLANG_WARN_ENUM_CONVERSION NO<br>
      )<br>
      <br>
      > cmake -H. -B_builds -GXcode<br>
      > cmake --build _builds<br>
      /.../usr/bin/clang ... -Wno-enum-conversion ...<br>
    </blockquote>
    <blockquote cite="mid:1431924624.22116.99.camel@mad-scientist.net"
      type="cite">
      <pre wrap="">

As mentioned, these builds are performed on build servers running OSX,
where basically the code is retrieved via Git, then cmake is run, then
cmake -build is run (which invokes xcodebuild via the command line), all
using SSH commands from a build control server.  At no time is Xcode
itself invoked.</pre>
    </blockquote>
    I don't understand what you mean by "no time is Xcode itself
    invoked". When you set generator to "Unix Makefiles" then Makefile
    project generated:<br>
    > cmake -H. -B_builds "-GUnix Makefiles"<br>
    > ls _builds/Makefile<br>
    _builds/Makefile<br>
    <br>
    when you set generator to "Xcode" then Xcode project used:<br>
    > cmake -H. -B_builds -GXcode<br>
    > ls _builds/Foo.xcodeproj/project.pbxproj<br>
    _builds/Foo.xcodeproj/project.pbxproj<br>
    <br>
    so there is no difference between:<br>
    * open Xcode project and hit "Build"<br>
    * cmake --build _builds<br>
    * (cd _builds && xcodebuild -alltargets)<br>
    <blockquote cite="mid:1431924624.22116.99.camel@mad-scientist.net"
      type="cite">
      <pre wrap="">

So, if the properties you describe are Xcode settings that need to be
tweaked then do you know if there is some command-line way to do it,
that I could encode into my build scripts for example?
</pre>
    </blockquote>
    See example above.<br>
    <br>
    Also you can use some helper functions to do it in cross-platform
    way:<br>
    <blockquote>
      <pre>sugar_generate_warning_flags(
    target_compile_options
    target_properties
    ENABLE enum-conversion
)

<span class="pl-c1">set_target_properties</span>(
    foo
    <span class="pl-k">PROPERTIES</span>
    <span class="pl-v">${target_properties}
</span>    COMPILE_OPTIONS
    <span class="pl-s">"<span class="pl-v">${target_compile_options}</span>"</span>
)

</pre>
    </blockquote>
    This will set MSVC flags too. See this wiki:
    <a class="moz-txt-link-freetext" href="https://github.com/ruslo/sugar/wiki/Cross-platform-warning-suppression">https://github.com/ruslo/sugar/wiki/Cross-platform-warning-suppression</a><br>
    <br>
    Cheers, Ruslo<br>
  </body>
</html>