aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/poppler/poppler/0001-cmake-Do-not-use-isystem.patch
blob: adbe82263f8ded0e2e39cc32fc2076afcaf1b0e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
From 04686340c4cd375a17d60d31bf6943367cc33214 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 21 Jan 2023 03:09:08 -0800
Subject: [PATCH] cmake: Do not use -isystem

isystem dirs are searched before the regular system dirs
this exposes an interesting include ordering problem when using
clang + libc++, when including C++ headers like <cstdlib>

cstdlib includes stdlib.h and in case of libc++, this should be coming
from libc++ as well, which is then eventually including system stdlib.h

libc++ has added a check for checking this order recently, which means
if cstlib ends up including system stdlib.h before libc++ provided
stdlib.h it errors out

/mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/thrift/0.17.0-r0/recipe-sysroot/usr/include/c++/v1/cstdlib:90:5: error: <cstdlib> tried including <stdlib.h> but didn't find libc++'s <stdlib.h> header.           This usually means that your header search paths are not configured properly.           The header search paths should contain the C++ Standard Library headers before           any C Standard Library, and you are probably using compiler flags that make that           not be the case.
    ^

The reason is that include_directories with SYSTEM property adds the
directory via -system and some of these directories point to sysroot
e.g. OPENSSL_INCLUDE_DIR which ends up adding -isystem
<sysroot>/usr/include and causes the system stdlib.h to included before
libc++ stdlib.h

A fix is to use -idirafter which preserved the effects of system headers
but instead of prepending, it will append to system headers and the
issue is addressed

Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
Upstream-Status: Pending

 CMakeLists.txt         |  4 ++--
 glib/CMakeLists.txt    |  4 ++--
 qt5/src/CMakeLists.txt |  4 ++--
 qt6/src/CMakeLists.txt |  4 ++--
 test/CMakeLists.txt    |  6 +++---
 utils/CMakeLists.txt   | 10 +++++-----
 6 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c6c757c..5f1c540 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -603,10 +603,10 @@ add_library(poppler ${poppler_SRCS})
 if (OpenJPEG_FOUND)
   # check if we can remove this when we depend on newer openjpeg versions, 2.5 seems fixed
   # target openjp2 may lack interface include directories
-  target_include_directories(poppler SYSTEM PRIVATE ${OPENJPEG_INCLUDE_DIRS})
+  target_include_directories(poppler  PRIVATE ${OPENJPEG_INCLUDE_DIRS})
 endif()
 if(USE_CMS)
-  target_include_directories(poppler SYSTEM PRIVATE ${LCMS2_INCLUDE_DIR})
+  target_include_directories(poppler  PRIVATE ${LCMS2_INCLUDE_DIR})
 endif()
 generate_export_header(poppler BASE_NAME poppler-private EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/poppler_private_export.h")
 set_target_properties(poppler PROPERTIES VERSION 127.0.0 SOVERSION 127)
diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
index 52e8687..08ab39a 100644
--- a/glib/CMakeLists.txt
+++ b/glib/CMakeLists.txt
@@ -4,7 +4,7 @@ include_directories(
 )
 
 include_directories(
-  SYSTEM
+  
   ${GLIB2_INCLUDE_DIRS}
   ${CAIRO_INCLUDE_DIRS}
 )
@@ -96,7 +96,7 @@ if(MINGW AND BUILD_SHARED_LIBS)
     set_target_properties(poppler-glib PROPERTIES SUFFIX "-${POPPLER_GLIB_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
 endif()
 target_link_libraries(poppler-glib poppler PkgConfig::GLIB2 ${CAIRO_LIBRARIES} Freetype::Freetype)
-target_include_directories(poppler-glib SYSTEM PRIVATE ${CAIRO_INCLUDE_DIRS})
+target_include_directories(poppler-glib  PRIVATE ${CAIRO_INCLUDE_DIRS})
 install(TARGETS poppler-glib RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
 
 install(FILES
diff --git a/qt5/src/CMakeLists.txt b/qt5/src/CMakeLists.txt
index 5db3a6c..f242d29 100644
--- a/qt5/src/CMakeLists.txt
+++ b/qt5/src/CMakeLists.txt
@@ -45,11 +45,11 @@ if(MINGW AND BUILD_SHARED_LIBS)
 endif()
 target_link_libraries(poppler-qt5 poppler Qt5::Core Qt5::Gui Qt5::Xml Freetype::Freetype)
 if (ENABLE_NSS3)
-    target_include_directories(poppler-qt5 SYSTEM PRIVATE ${NSS3_INCLUDE_DIRS})
+    target_include_directories(poppler-qt5  PRIVATE ${NSS3_INCLUDE_DIRS})
 endif()
 if(USE_CMS)
     target_link_libraries(poppler-qt5 poppler ${LCMS2_LIBRARIES})
-    target_include_directories(poppler-qt5 SYSTEM PRIVATE ${LCMS2_INCLUDE_DIR})
+    target_include_directories(poppler-qt5  PRIVATE ${LCMS2_INCLUDE_DIR})
 endif()
 install(TARGETS poppler-qt5 RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
 
diff --git a/qt6/src/CMakeLists.txt b/qt6/src/CMakeLists.txt
index cd91975..6c42e12 100644
--- a/qt6/src/CMakeLists.txt
+++ b/qt6/src/CMakeLists.txt
@@ -45,11 +45,11 @@ if(MINGW AND BUILD_SHARED_LIBS)
 endif()
 target_link_libraries(poppler-qt6 poppler Qt6::Core Qt6::Gui Freetype::Freetype)
 if (ENABLE_NSS3)
-    target_include_directories(poppler-qt6 SYSTEM PRIVATE ${NSS3_INCLUDE_DIRS})
+    target_include_directories(poppler-qt6  PRIVATE ${NSS3_INCLUDE_DIRS})
 endif()
 if(USE_CMS)
     target_link_libraries(poppler-qt6 poppler ${LCMS2_LIBRARIES})
-    target_include_directories(poppler-qt6 SYSTEM PRIVATE ${LCMS2_INCLUDE_DIR})
+    target_include_directories(poppler-qt6  PRIVATE ${LCMS2_INCLUDE_DIR})
 endif()
 install(TARGETS poppler-qt6 RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
 
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index afa1352..9bd3b9a 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -23,7 +23,7 @@ if (GTK_FOUND)
   )
   poppler_add_test(gtk-test BUILD_GTK_TESTS ${gtk_splash_test_SRCS})
   target_link_libraries(gtk-test ${CAIRO_LIBRARIES} poppler-glib PkgConfig::GTK3)
-  target_include_directories(gtk-test SYSTEM PRIVATE ${CAIRO_INCLUDE_DIRS})
+  target_include_directories(gtk-test  PRIVATE ${CAIRO_INCLUDE_DIRS})
 
   if (HAVE_CAIRO)
 
@@ -35,7 +35,7 @@ if (GTK_FOUND)
     )
     poppler_add_test(pdf-inspector BUILD_GTK_TESTS ${pdf_inspector_SRCS})
     target_link_libraries(pdf-inspector ${CAIRO_LIBRARIES} Freetype::Freetype ${common_libs} PkgConfig::GTK3 poppler)
-    target_include_directories(pdf-inspector SYSTEM PRIVATE ${CAIRO_INCLUDE_DIRS})
+    target_include_directories(pdf-inspector  PRIVATE ${CAIRO_INCLUDE_DIRS})
     target_compile_definitions(pdf-inspector PRIVATE -DSRC_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
   endif ()
 
@@ -59,7 +59,7 @@ if (HAVE_CAIRO)
       )
     add_executable(cairo-thread-test ${cairo_thread_test_SRCS})
     target_link_libraries(cairo-thread-test ${CAIRO_LIBRARIES} Freetype::Freetype Threads::Threads poppler)
-    target_include_directories(cairo-thread-test SYSTEM PRIVATE ${CAIRO_INCLUDE_DIRS})
+    target_include_directories(cairo-thread-test  PRIVATE ${CAIRO_INCLUDE_DIRS})
   endif ()
 endif ()
 
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 1c3ebcb..bc1840a 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -16,7 +16,7 @@ add_executable(pdftoppm ${pdftoppm_SOURCES})
 target_link_libraries(pdftoppm ${common_libs})
 if(LCMS2_FOUND)
   target_link_libraries(pdftoppm ${LCMS2_LIBRARIES})
-  target_include_directories(pdftoppm SYSTEM PRIVATE ${LCMS2_INCLUDE_DIR})
+  target_include_directories(pdftoppm  PRIVATE ${LCMS2_INCLUDE_DIR})
 endif()
 install(TARGETS pdftoppm DESTINATION bin)
 install(FILES pdftoppm.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
@@ -37,10 +37,10 @@ if (HAVE_CAIRO)
   add_definitions(${CAIRO_CFLAGS})
   add_executable(pdftocairo ${pdftocairo_SOURCES})
   target_link_libraries(pdftocairo ${CAIRO_LIBRARIES} Freetype::Freetype ${common_libs})
-  target_include_directories(pdftocairo SYSTEM PRIVATE ${CAIRO_INCLUDE_DIRS})
+  target_include_directories(pdftocairo  PRIVATE ${CAIRO_INCLUDE_DIRS})
   if(LCMS2_FOUND)
     target_link_libraries(pdftocairo ${LCMS2_LIBRARIES})
-    target_include_directories(pdftocairo SYSTEM PRIVATE ${LCMS2_INCLUDE_DIR})
+    target_include_directories(pdftocairo  PRIVATE ${LCMS2_INCLUDE_DIR})
   endif()
   install(TARGETS pdftocairo DESTINATION bin)
   install(FILES pdftocairo.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
@@ -99,7 +99,7 @@ if (ENABLE_NSS3)
     pdfsig.cc
   )
   add_executable(pdfsig ${pdfsig_SOURCES})
-  target_include_directories(pdfsig SYSTEM PRIVATE ${NSS3_INCLUDE_DIRS})
+  target_include_directories(pdfsig  PRIVATE ${NSS3_INCLUDE_DIRS})
   target_link_libraries(pdfsig ${common_libs})
   install(TARGETS pdfsig DESTINATION bin)
   install(FILES pdfsig.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
@@ -114,7 +114,7 @@ add_executable(pdftops ${pdftops_SOURCES})
 target_link_libraries(pdftops ${common_libs})
 if(LCMS2_FOUND)
   target_link_libraries(pdftops ${LCMS2_LIBRARIES})
-  target_include_directories(pdftops SYSTEM PRIVATE ${LCMS2_INCLUDE_DIR})
+  target_include_directories(pdftops  PRIVATE ${LCMS2_INCLUDE_DIR})
 endif()
 install(TARGETS pdftops DESTINATION bin)
 install(FILES pdftops.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)