Repository: conan-io/conan-center-index

Issue:
[package] freeimage/3.18.0: Plugins aren't enabled
The preprocessor symbols used in the patches (WITH_JPEG etc.) are not defined by cmake.

### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **freeimage/3.18.0**
  * Operating System+version: **Windows 11**
  * Compiler+version: **Visual Studio 2019**
  * Conan version: **conan 1.46.2**
  * Python version: **Python 3.10.3**


### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)
```
[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=16
```


### Steps to reproduce (Include if Applicable)

Load image with any optional plugin (JPEG, PNG, TIFF, etc).  The test package didn't check for errors.

### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
freeimage/3.18.0 (test package): Running test()
FreeImage 3.18.0, with:
	- bmp
	- ico
	- jng
	- koa
	- iff,lbm
	- mng
	- pbm
	- pbm
	- pcd
	- pcx
	- pgm
	- pgm
	- ppm
	- ppm
	- ras
	- tga,targa
	- wap,wbmp,wbm
	- psd,psb
	- cut
	- xbm
	- xpm
	- dds
	- gif
	- hdr
	- sgi,rgb,rgba,bw
	- pfm
	- pct,pict,pic
```

Should be:

```
freeimage/3.18.0 (test package): Running test()
FreeImage 3.18.0, with:
	- bmp
	- ico
	- jpg,jif,jpeg,jpe
	- jng
	- koa
	- iff,lbm
	- mng
	- pbm
	- pbm
	- pcd
	- pcx
	- pgm
	- pgm
	- png
	- ppm
	- ppm
	- ras
	- tga,targa
	- tif,tiff
	- wap,wbmp,wbm
	- psd,psb
	- cut
	- xbm
	- xpm
	- dds
	- gif
	- hdr
	- sgi,rgb,rgba,bw
	- exr
	- j2k,j2c
	- jp2
	- pfm
	- pct,pict,pic
	- 3fr,arw,bay,bmq,cap,cine,cr2,crw,cs1,dc2,dcr,drf,dsc,dng,erf,fff,ia,iiq,k25,kc2,kdc,mdc,mef,mos,mrw,nef,nrw,orf,pef,ptx,pxn,qtk,raf,raw,rdc,rw2,rwl,rwz,sr2,srf,srw,sti,x3f
	- webp
	- jxr,wdp,hdp
```

</details>



Discussion:

Resolving patch:
diff --git a/recipes/freeimage/all/conanfile.py b/recipes/freeimage/all/conanfile.py
--- a/recipes/freeimage/all/conanfile.py
+++ b/recipes/freeimage/all/conanfile.py
@@ -13,6 +13,7 @@ class FreeImageConan(ConanFile):
     url = "https://github.com/conan-io/conan-center-index"
     license = "FreeImage", "GPL-3.0-or-later", "GPL-2.0-or-later"
     topics = ("freeimage", "image", "decoding", "graphics")
+    short_paths = True
     generators = "cmake", "cmake_find_package"
     settings = "os", "arch", "compiler", "build_type"
     options = {


Test patch:
diff --git a/recipes/freeimage/all/test_package/test_package.cpp b/recipes/freeimage/all/test_package/test_package.cpp
--- a/recipes/freeimage/all/test_package/test_package.cpp
+++ b/recipes/freeimage/all/test_package/test_package.cpp
@@ -2,7 +2,9 @@
 
 #include <FreeImage.h>
 
-#define NEED_INIT defined(FREEIMAGE_LIB) || !defined(WIN32)
+#if defined(FREEIMAGE_LIB) || !defined(WIN32)
+#define NEED_INIT 1
+#endif
 
 void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char* message)
 {
@@ -32,12 +34,12 @@ int main(int argc, char** argv )
     const char * image_file = argv[1];
     FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
     fif = FreeImage_GetFileType(image_file, 0);
-    if(fif == FIF_UNKNOWN) {
+    if (fif == FIF_UNKNOWN) {
         fif = FreeImage_GetFIFFromFilename(image_file);
     }
-    if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) {
+    if ((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) {
         FIBITMAP* dib = FreeImage_Load(fif, image_file, 0);
-        if(dib)
+        if (dib)
         {
             FreeImage_Unload(dib);
         }