Any help would be appreciated. 

In particular I’d like to know how the default compiler arguments are set when ‘cmake -G Xcode’ is executed. The attached file contains the cmake test compile extracted and reformatted from CMakeOutput.log that should have failed. Again, what is setting all the clang compiler options when this is executed?

    
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
 \
 -x \
 c \
 -arch \
 x86_64 \
 -fmessage-length=0 \
 -fdiagnostics-show-note-include-stack \
 -fmacro-backtrace-limit=0 \
 -Wno-trigraphs \
 -fpascal-strings \
 -O0 \
 -Wno-missing-field-initializers \
 -Wno-missing-prototypes \
 -Wno-return-type \
 -Wno-missing-braces \
 -Wparentheses \
 -Wswitch \
 -Wno-unused-function \
 -Wno-unused-label \
 -Wno-unused-parameter \
 -Wno-unused-variable \
 -Wunused-value \
 -Wno-empty-body \
 -Wno-uninitialized \
 -Wno-unknown-pragmas \
 -Wno-shadow \
 -Wno-four-char-constants \
 -Wno-conversion \
 -Wno-constant-conversion \
 -Wno-int-conversion \
 -Wno-bool-conversion \
 -Wno-enum-conversion \
 -Wno-shorten-64-to-32 \
 -Wpointer-sign \
 -Wno-newline-eof \
 -DCMAKE_INTDIR=\"Debug\" \
 -isysroot \
 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
 \
 -fasm-blocks \
 -fstrict-aliasing \
 -Wdeprecated-declarations \
 -mmacosx-version-min=10.11 \
 -g \
 -Wno-sign-conversion \
 
-I/Users/user1/develop/wireshark-2.0/xcode_build/CMakeFiles/CMakeTmp/Debug/include
 \
 
-I/Users/user1/develop/wireshark-2.0/xcode_build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_3674d.build/DerivedSources/x86_64
 \
 
-I/Users/user1/develop/wireshark-2.0/xcode_build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_3674d.build/DerivedSources
 \
 -Wmost \
 -Wno-four-char-constants \
 -Wno-unknown-pragmas \
 -F/Users/user1/develop/wireshark-2.0/xcode_build/CMakeFiles/CMakeTmp/Debug \
 -Wall \
 -W \
 -Wextra \
 -Wendif-labels \
 -Wpointer-arith \
 -Warray-bounds \
 -Wformat-security \
 -fwrapv \
 -fno-strict-overflow \
 -Wvla \
 -Waddress \
 -Wattributes \
 -Wdiv-by-zero \
 -Wignored-qualifiers \
 -Wpragmas \
 -Wno-overlength-strings \
 -Wno-long-long \
 -Wheader-guard \
 -Wunused-const-variable \
 -Qunused-arguments \
 -Wc++-compat \
 -Wdeclaration-after-statement \
 -Wshadow \
 -Wno-pointer-sign \
 -Wold-style-definition \
 -Wstrict-prototypes \
 -Wshorten-64-to-32 \
 -fvisibility=hidden \
 -DWS_LD_FLAG_VALID0 \
 -Wl,--as-needed \
 -fPIE \
 -MMD \
 -MT \
 dependencies \
 -MF \
 /Users/user1/develop/src.d \
 --serialize-diagnostics \
 /Users/user1/develop/src.dia \
 -c \
 /Users/user1/develop/src.c \
 -o \
 /Users/user1/develop/src.o

All help is appreciated

On Jan 18, 2016, at 2:58 PM, David Morsberger <d...@morsberger.com> wrote:

I’m having an issue generating and using a XCode project using cmake -G.

cmake —version
    cmake version 3.4.1

Xcode Version 7.2 (7C68)

Mac OS 10.11.


My CMakeLists.txt has a clang option that fails during the -G Xcode pass but fails when linking within XCode.

The compiler / linker option is ‘-Wl,—as-needed’

The test compile/link step in ‘cmake -G Xcode' creates a long clang command with arguments ‘-Wl,—as-needed’ plus ‘—serialize-diagnostics <path to .dia file>’

The link step within Xcode after the project created has the ‘-Wl,—as-needed’ argument and does not have the ‘—serialize-diagnostics <path to .dia file>’ argument. The link fails because ‘-Wl,—as-needed’ isn’t supported.

If copy and execute the long clang command from the ‘cmake -G Xcode’ command and remove the ‘—serialize-diagnostics <path to .dia file>’ then it successfully fails with ‘-Wl, —as-needed’ isn’t supported. 

Finally, when I use cmake to generate unix makefiles it works meaning cmake determines ‘-Wl—as-needed’ isn’t supported and doesn’t add it to the argument list.

Questions:
 - Where is the ‘—serialized-diagnostics’ argument coming from when executing ‘cmake -G Xcode’?

 - What is a .dia file and how do I read it?

 - What’s the preferred / recommended way of detecting the non-supported ‘-Wl,—as-needed’ argument during the ‘cmake -G Xcode’ phase? One option might to be to remove the ‘—serialize-diagnostics’ argument during the generation phase.

I can provide more details on request.

David







-- 

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