Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1 | From dbf0a3f6ea77a1d5f5e3c4dec7a22fcc09a49537 Mon Sep 17 00:00:00 2001 |
| 2 | From: Max Krummenacher <max.krummenacher@toradex.com> |
| 3 | Date: Mon, 10 Jan 2022 21:52:02 +0000 |
| 4 | Subject: [PATCH] cmake: sdlchecks.cmake: pass cflags to the appropriate cmake |
| 5 | variable |
| 6 | |
| 7 | If egl.pc sets at least two macros as the i.MX Vivante driver does, e.g.: |
| 8 | | Cflags: -I${includedir} -DLINUX -DWL_EGL_PLATFORM |
| 9 | |
| 10 | then we get the following error during configuration: |
| 11 | |
| 12 | | -- Performing Test HAVE_OPENGL_EGL |
| 13 | | CMake Error: Parse error in command line argument: WL_EGL_PLATFORM |
| 14 | | Should be: VAR:type=value |
| 15 | |
| 16 | If one changes to add a value to the macro, e.g. |
| 17 | | Cflags: -I${includedir} -DLINUX=1 -DWL_EGL_PLATFORM=1 |
| 18 | then cmake does not error out but the macro is not passed to the |
| 19 | C compiler. |
| 20 | |
| 21 | CMAKE_REQUIRED_FLAGS is the wrong variable to pass the CFLAGS in, |
| 22 | CMAKE_REQUIRED_DEFINITIONS should be used. |
| 23 | |
| 24 | Upstream-Status: Submitted [https://github.com/libsdl-org/SDL/pull/5209] |
| 25 | Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> |
| 26 | --- |
| 27 | cmake/sdlchecks.cmake | 3 +-- |
| 28 | 1 file changed, 1 insertion(+), 2 deletions(-) |
| 29 | |
| 30 | diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake |
| 31 | index 32be19c..f61b8df 100644 |
| 32 | --- a/cmake/sdlchecks.cmake |
| 33 | +++ b/cmake/sdlchecks.cmake |
| 34 | @@ -808,8 +808,7 @@ endmacro() |
| 35 | macro(CheckEGL) |
| 36 | if (SDL_OPENGL OR SDL_OPENGLES) |
| 37 | pkg_check_modules(EGL egl) |
| 38 | - string(REPLACE "-D_THREAD_SAFE;" "-D_THREAD_SAFE=1;" EGL_CFLAGS "${EGL_CFLAGS}") |
| 39 | - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${EGL_CFLAGS}") |
| 40 | + set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${EGL_CFLAGS}") |
| 41 | check_c_source_compiles(" |
| 42 | #define EGL_API_FB |
| 43 | #define MESA_EGL_NO_X11_HEADERS |
| 44 | -- |
| 45 | 2.20.1 |
| 46 | |