cmake error for c / obj-c files

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

cmake error for c / obj-c files

Postby sdiverdi » Tue Jan 26, 2021 10:31 pm

I've found a bug in the cmake configuration of CEF that makes adding .c and .m files (C and Obj-C respectively) to a project fail to compile in Xcode 12.3. Specifically, this line:
https://bitbucket.org/chromiumembedded/ ... #lines-278
Code: Select all
    -std=gnu++11                    # Use the C++11 language standard including GNU extensions

combined with this line:
https://bitbucket.org/chromiumembedded/ ... #lines-275
Code: Select all
  target_compile_options(${target} PRIVATE ${CEF_COMPILER_FLAGS} ${CEF_CXX_COMPILER_FLAGS})

results in -std=gnu++11 getting added to the Xcode C flags, which causes a compiler error (because gnu++11 is not a valid standard for C or Obj-C). The fix is simple, just remove the line from cef_variables.cmake.in, which removes the flag, which is unnecessary because the language standard for Xcode is set in:
https://bitbucket.org/chromiumembedded/ ... #lines-305
Code: Select all
      XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD                 "gnu++11"   # -std=gnu++11

Then .c and .m files can be successfully included in a project.
sdiverdi
Mentor
 
Posts: 51
Joined: Fri Dec 25, 2020 7:41 pm

Re: cmake error for c / obj-c files

Postby magreenblatt » Tue Jan 26, 2021 11:46 pm

Can you submit a PR for the fix? Thanks.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 95 guests