@@ -164,28 +164,35 @@ def _patch_sources(self):
164
164
## We have to be more aggressive with dependencies found with pkgconfig
165
165
## Injection of libdirs is ensured by conan_basic_setup()
166
166
## openjpeg
167
- replace_in_file (self , cmakelists , "if(NOT JP2K)" , "if(0)" )
167
+ if Version (self .version ) < "1.83.0" :
168
+ # versions below 1.83.0 do not have an option toggle
169
+ replace_in_file (self , cmakelists , "if(NOT JP2K)" , "if(0)" )
170
+ if not self .options .with_openjpeg :
171
+ replace_in_file (self , cmakelists_src , "if (JP2K_FOUND)" , "if(0)" )
172
+ replace_in_file (self , cmake_configure , "if (JP2K_FOUND)" , "if(0)" )
173
+ else :
174
+ replace_in_file (self , cmakelists , "set(JP2K_INCLUDE_DIRS ${OPENJPEG_INCLUDE_DIRS})" , "set(JP2K_INCLUDE_DIRS ${OpenJPEG_INCLUDE_DIRS})" )
175
+
168
176
replace_in_file (self , cmakelists_src ,
169
177
"if (JP2K_FOUND)" ,
170
178
"if (JP2K_FOUND)\n "
171
179
"target_link_directories(leptonica PRIVATE ${JP2K_LIBRARY_DIRS})\n "
172
180
"target_compile_definitions(leptonica PRIVATE ${JP2K_CFLAGS_OTHER})" )
173
- if not self .options .with_openjpeg :
174
- replace_in_file (self , cmakelists_src , "if (JP2K_FOUND)" , "if(0)" )
175
- replace_in_file (self , cmake_configure , "if (JP2K_FOUND)" , "if(0)" )
176
181
## libwebp
177
- replace_in_file (self , cmakelists , "if(NOT WEBP)" , "if(0)" )
182
+ if Version (self .version ) < "1.83.0" :
183
+ # versions below 1.83.0 do not have an option toggle
184
+ replace_in_file (self , cmakelists , "if(NOT WEBP)" , "if(0)" )
185
+ if Version (self .version ) >= "1.79.0" :
186
+ replace_in_file (self , cmakelists , "if(NOT WEBPMUX)" , "if(0)" )
187
+ if not self .options .with_webp :
188
+ replace_in_file (self , cmakelists_src , "if (WEBP_FOUND)" , "if(0)" )
189
+ replace_in_file (self , cmake_configure , "if (WEBP_FOUND)" , "if(0)" )
178
190
replace_in_file (self , cmakelists_src ,
179
191
"if (WEBP_FOUND)" ,
180
192
"if (WEBP_FOUND)\n "
181
193
"target_link_directories(leptonica PRIVATE ${WEBP_LIBRARY_DIRS} ${WEBPMUX_LIBRARY_DIRS})\n "
182
194
"target_compile_definitions(leptonica PRIVATE ${WEBP_CFLAGS_OTHER} ${WEBPMUX_CFLAGS_OTHER})" )
183
195
replace_in_file (self , cmakelists_src , "${WEBP_LIBRARIES}" , "${WEBP_LIBRARIES} ${WEBPMUX_LIBRARIES}" )
184
- if Version (self .version ) >= "1.79.0" :
185
- replace_in_file (self , cmakelists , "if(NOT WEBPMUX)" , "if(0)" )
186
- if not self .options .with_webp :
187
- replace_in_file (self , cmakelists_src , "if (WEBP_FOUND)" , "if(0)" )
188
- replace_in_file (self , cmake_configure , "if (WEBP_FOUND)" , "if(0)" )
189
196
190
197
# Remove detection of fmemopen() on macOS < 10.13
191
198
# CheckFunctionExists will find it in the link library.
0 commit comments