On 18-May-15 06:50, Paul Smith wrote:
On Sun, 2015-05-17 at 14:43 +0200, Ruslan Baratov via CMake wrote:
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:
https://github.com/ruslo/leathers/wiki/List#xcodeclang-table
Thanks for your reply... but I don't quite understand what this table is
telling me.
This table tells you what attribute you need to set to disable/enable specific warning.
E.g.:

   | Clang           | Xcode                      |

   +-----------------+----------------------------+

   | enum-conversion | CLANG_WARN_ENUM_CONVERSION |


Makefile generator:

    > cat CMakeLists.txt
   cmake_minimum_required(VERSION 3.0)
   project(Foo)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wenum-conversion")
   add_library(foo foo.cpp)

    > cmake -H. -B_builds "-GUnix Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON
    > cmake --build _builds
   /.../usr/bin/c++ -Wenum-conversion ...


Xcode generator (default):

    > cat CMakeLists.txt
   cmake_minimum_required(VERSION 3.0)
   project(Foo)
   add_library(foo foo.cpp)

    > cmake -H. -B_builds -GXcode
    > cmake --build _builds
   /.../usr/bin/clang ... -Wno-enum-conversion ...

Xcode generator (enable):

    > cat CMakeLists.txt
   cmake_minimum_required(VERSION 3.0)
   project(Foo)
   add_library(foo foo.cpp)

   set_target_properties(
        foo
        PROPERTIES
        XCODE_ATTRIBUTE_CLANG_WARN_ENUM_CONVERSION YES
   )

    > cmake -H. -B_builds -GXcode
    > cmake --build _builds
   /.../usr/bin/clang ... -Wenum-conversion ...

Xcode generator (disable):

    > cat CMakeLists.txt
   cmake_minimum_required(VERSION 3.0)
   project(Foo)
   add_library(foo foo.cpp)

   set_target_properties(
        foo
        PROPERTIES
        XCODE_ATTRIBUTE_CLANG_WARN_ENUM_CONVERSION NO
   )

    > cmake -H. -B_builds -GXcode
    > cmake --build _builds
   /.../usr/bin/clang ... -Wno-enum-conversion ...


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.
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:
> cmake -H. -B_builds "-GUnix Makefiles"
> ls _builds/Makefile
_builds/Makefile

when you set generator to "Xcode" then Xcode project used:
> cmake -H. -B_builds -GXcode
> ls _builds/Foo.xcodeproj/project.pbxproj
_builds/Foo.xcodeproj/project.pbxproj

so there is no difference between:
* open Xcode project and hit "Build"
* cmake --build _builds
* (cd _builds && xcodebuild -alltargets)

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?
See example above.

Also you can use some helper functions to do it in cross-platform way:

   sugar_generate_warning_flags(
        target_compile_options
        target_properties
        ENABLE enum-conversion
   )

   set_target_properties(
        foo
        PROPERTIES
        ${target_properties}
        COMPILE_OPTIONS
        "${target_compile_options}"
   )

This will set MSVC flags too. See this wiki: https://github.com/ruslo/sugar/wiki/Cross-platform-warning-suppression

Cheers, Ruslo
-- 

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