GNOME Bugzilla – Bug 773659
Don't set CFLAGS returned by pkg-config as CMAKE_REQUIRED_FLAGS
Last modified: 2016-10-31 17:04:16 UTC
It seems that specifying -D arguments is not allowed in CMAKE_REQUIRED_FLAGS when using CHECK_C_SOURCE_COMPILES. Please see the attached patch that avoids the problem.
Created attachment 338768 [details] [review] Bug 773659 - Don't set CFLAGS returned by pkg-config as CMAKE_REQUIRED_FLAGS When CFLAGS returned by pkg-config contains -D arguments, it may cause check to fail with internal error: -- Performing Test HAVE_ICAL_UNKNOWN_TOKEN_HANDLING Parse error in command line argument: -D_THREAD_SAFE Should be: VAR:type=value CMake Error: No cmake script provided. CMake Error: Internal CMake error, TryCompile configure of cmake failed -- Performing Test HAVE_ICAL_UNKNOWN_TOKEN_HANDLING - Failed -- Performing Test HAVE_ICALTZUTIL_SET_EXACT_VTIMEZONES_SUPPORT Parse error in command line argument: -D_THREAD_SAFE Should be: VAR:type=value CMake Error: No cmake script provided. CMake Error: Internal CMake error, TryCompile configure of cmake failed -- Performing Test HAVE_ICALTZUTIL_SET_EXACT_VTIMEZONES_SUPPORT - Failed To avoid the issue, we use CMAKE_REQUIRED_DEFINITIONS to set flags other than -I. _CFLAGS_OTHER is used instead of _CFLAGS because -I arguments are already added by using _INCLUDE_DIRS and CMAKE_REQUIRED_INCLUDES.
Thanks for a bug report and patch. Why did it fail here, but not in the eds? https://git.gnome.org/browse/evolution-data-server/tree/CMakeLists.txt#n857 I suppose due to other module defining that -D_THREAD_SAFE, one which is not part of CALENDAR, but is part of EVOLUTION_DATA_SERVER modules. I'll use the same approach in the eds too, to be consistent.
And also evolution-mapi, where I fixed one other typo in the script. Created commit_27b477f in eds master (3.23.2+) [1] Created commit 37eac9c in evo master (3.23.2+) Created commit_2d03ed5 in ema master (3.23.2+) [2] [1] https://git.gnome.org/browse/evolution-data-server/commit/?id=27b477f [2] https://git.gnome.org/browse/evolution-mapi/commit/?id=2d03ed5
(In reply to Milan Crha from comment #2) > Thanks for a bug report and patch. Why did it fail here, but not in the eds? > > https://git.gnome.org/browse/evolution-data-server/tree/CMakeLists.txt#n857 > > I suppose due to other module defining that -D_THREAD_SAFE, one which is not > part of CALENDAR, but is part of EVOLUTION_DATA_SERVER modules. I'll use the > same approach in the eds too, to be consistent. -D_THREAD_SAFE get added when running 'pkg-config --cflags libedataserverui-1.2'. I think it probably comes from x11.pc.