Repository: conan-io/conan-center-index

Issue:
Add openexr 2.4.0
Specify library name and version:  **openexr/2.4.0**

- [x] I've read the [guidelines](https://github.com/conan-io/conan-center-index/wiki#how-to-submit-a-pull-request) for contributing.
- [x] I've followed the [PEP8](https://www.python.org/dev/peps/pep-0008/) style guides for Python code in the recipes.
- [x] I've used the [latest](https://github.com/conan-io/conan/releases/latest) Conan client version.
- [x] I've tried at least one configuration locally with the
      [conan-center hook](https://github.com/conan-io/hooks.git) activated.

## TODO 
- [ ] patch cmake file for disable build examples
- [x] test_package add example 
- [ ] add option build with PyIlmBase?? (optional need boost)

not finished


Discussion:
Sorry, the system is under maintenance and it doesn't accept builds right now. Thanks for your understanding and help with the EAP program!
Conan Community has a recipe for openexr as well: https://github.com/conan-community/conan-openexr
Sorry, the system is under maintenance and it doesn't accept builds right now. Thanks for your understanding and help with the EAP program!
Sorry, the system is under maintenance and it doesn't accept builds right now. Thanks for your understanding and help with the EAP program!
Some configurations of 'openexr/2.4.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - Hooks errors detected:
        - `[HOOK - conan-center.py] pre_export(): ERROR: [CMAKE MINIMUM VERSION (KB-H028)] The CMake file './CMakeLists.txt' must contain a minimum version declared (e.g. cmake_minimum_required(VERSION 3.1.2)) (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H028) `
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/4/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/4/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/4/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/4/openexr/2.4.0/)
Some configurations of 'openexr/2.4.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - Hooks errors detected:
        - `[HOOK - conan-center.py] post_package(): ERROR: [PACKAGE LICENSE (KB-H012)] No 'licenses' folder found in package: /tmp/c3ipr/pr_204_5_0_0/.conan/data/openexr/2.4.0/_/_/package/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373  (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H012) `
        - `[HOOK - conan-center.py] post_package(): ERROR: [PC-FILES (KB-H020)] The conan-center repository doesn't allow the packages to contain `pc` files. The packages have to be located using generators and the declared `cpp_info` information (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H020) `
        - `[HOOK - conan-center.py] post_package(): ERROR: [PC-FILES (KB-H020)] Found files:`
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/5/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/5/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/5/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/5/openexr/2.4.0/)
Some configurations of 'openexr/2.4.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - Hooks errors detected:
        - `[HOOK - conan-center.py] post_package(): ERROR: [PC-FILES (KB-H020)] The conan-center repository doesn't allow the packages to contain `pc` files. The packages have to be located using generators and the declared `cpp_info` information (https://github.com/conan-io/conan-center-index/wiki/Error-Knowledge-Base#KB-H020) `
        - `[HOOK - conan-center.py] post_package(): ERROR: [PC-FILES (KB-H020)] Found files:`
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/6/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/6/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/6/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/6/openexr/2.4.0/)
Some configurations of 'openexr/2.4.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/7/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/7/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/7/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/7/openexr/2.4.0/)
Some configurations of 'openexr/2.4.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/8/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/8/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/8/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/8/openexr/2.4.0/)
Some configurations of 'openexr/2.4.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/9/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/9/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/9/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/9/openexr/2.4.0/)
Some configurations of 'openexr/2.4.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/10/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/10/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/10/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/10/openexr/2.4.0/)
Some configurations of 'openexr/2.4.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/11/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/11/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/11/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/11/openexr/2.4.0/)
Some configurations of 'openexr/2.4.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/12/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/12/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/12/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/12/openexr/2.4.0/)
When self.cpp_info.cppflags = ["pthread"],i have error in test_package

Scanning dependencies of target test_package
[ 50%] Building CXX object CMakeFiles/test_package.dir/test_package.cpp.o
g++: error: pthread: No such file or directory

test_package is empty now

`
#include <string>
#include <iostream>

int main(int argc, char **argv)
{
	return 0;
}

`
waiting for this pull  https://github.com/conan-io/conan-center-index/pull/217 (Fix zlib name for CMake generator)


> When self.cpp_info.cppflags = ["pthread"],i have error in test_package
> 
> `
it should be `self.cpp_info.libs.append("pthread")` instead


Some configurations of 'openexr/2.4.0' have failed:
-   **Macos x86_64, Debug, apple-clang 9.1, libc++ . Options:  openexr:shared-True**
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/13/openexr/2.4.0/42472682e349c03bf7a42aa5ca259c4e97bb0149/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/13/openexr/2.4.0/42472682e349c03bf7a42aa5ca259c4e97bb0149/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/13/openexr/2.4.0/42472682e349c03bf7a42aa5ca259c4e97bb0149/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/13/openexr/2.4.0/)
Some configurations of 'openexr/2.3.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/14/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/14/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/14/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/14/openexr/2.3.0/)
Some configurations of 'openexr/2.3.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/15/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/15/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/15/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/15/openexr/2.3.0/)
Some configurations of 'openexr/2.3.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/16/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/16/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/16/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/16/openexr/2.3.0/)
Some configurations of 'openexr/2.3.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/17/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/17/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/17/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/17/openexr/2.3.0/)
Some configurations of 'openexr/2.3.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/18/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/18/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/18/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/18/openexr/2.3.0/)
Some configurations of 'openexr/2.3.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/19/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/19/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/19/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/19/openexr/2.3.0/)
@gunmetal313 
I think I fixed this in https://github.com/madebr/conan-center-index/tree/openexr_pr
Feel free to merge
The config.yml file is invalid: Only one library can be changed in the same PR: [openexr/2.3.0, openexr/2.4.0]
Some configurations of 'openexr/2.3.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/21/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/21/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/21/openexr/2.3.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/21/openexr/2.3.0/)
Some configurations of 'openexr/2.4.0' have failed:
-   **Linux x86_64, Release, gcc 5, libstdc++ . Options:  openexr:shared-True**
    - [Log download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/22/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stdout.txt)
    - [Log error Download](https://c3i.jfrog.io/c3i/misc/logs/pr/204/22/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/create_stderr.txt)
    - [Profile](https://c3i.jfrog.io/c3i/misc/logs/pr/204/22/openexr/2.4.0/9365bca67edbaa1d1ba5dfd8a44f4f6f6f780373/profile.txt)
- [Access to all the logs](https://c3i.jfrog.io/c3i/misc/logs/pr/204/22/openexr/2.4.0/)

Resolving patch:
diff --git a/recipes/openexr/2.4.0/conanfile.py b/recipes/openexr/2.4.0/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/openexr/2.4.0/conanfile.py
@@ -0,0 +1,90 @@
+from conans import ConanFile, CMake, tools
+import os
+
+
+class OpenEXRConan(ConanFile):
+    name = "openexr"
+    version = "2.4.0"
+    description = "OpenEXR is a high dynamic-range (HDR) image file format developed by Industrial Light & " \
+                  "Magic for use in computer imaging applications."
+    topics = ("conan", "openexr", "hdr", "image", "picture")
+    license = "BSD-3-Clause"
+    homepage = "https://github.com/openexr/openexr"
+    url = "https://github.com/conan-io/conan-center-index"
+    settings = "os", "compiler", "build_type", "arch"
+    options = {"shared": [True, False], "fPIC": [True, False]}
+    default_options = {"shared": False, "fPIC": True}
+    generators = "cmake", "cmake_find_package"
+    exports_sources = "CMakeLists.txt"
+
+    _source_subfolder = "source_subfolder"
+
+    def config_options(self):
+        if self.settings.os == "Windows":
+            self.options.remove("fPIC")
+
+    def requirements(self):
+        self.requires("zlib/1.2.11")
+
+    def source(self):
+        tools.get(**self.conan_data["sources"][self.version])
+        os.rename("openexr-{}".format(self.version), self._source_subfolder)
+
+    def _configure_cmake(self):
+        cmake = CMake(self)
+        cmake.definitions["PYILMBASE_ENABLE"] = False
+        cmake.definitions["OPENEXR_VIEWERS_ENABLE"] = False
+        cmake.definitions["OPENEXR_BUILD_BOTH_STATIC_SHARED"] = False
+        cmake.definitions["OPENEXR_BUILD_UTILS"] = False
+        cmake.definitions["BUILD_TESTING"] = False
+        cmake.configure()
+        return cmake
+
+    def _patch_files(self):
+        for lib in ("OpenEXR", "IlmBase"):
+            if self.settings.os == "Windows":
+                tools.replace_in_file(os.path.join(self._source_subfolder,  lib, "config", "LibraryDefine.cmake"),
+                                      "${CMAKE_COMMAND} -E chdir ${CMAKE_INSTALL_FULL_LIBDIR}",
+                                      "${CMAKE_COMMAND} -E chdir ${CMAKE_INSTALL_FULL_BINDIR}")
+            if self.settings.build_type == "Debug":
+                tools.replace_in_file(os.path.join(self._source_subfolder,  lib, "config", "LibraryDefine.cmake"),
+                                      "set(verlibname ${CMAKE_SHARED_LIBRARY_PREFIX}${libname}${@LIB@_LIB_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX})".replace("@LIB@", lib.upper()),
+                                      "set(verlibname ${CMAKE_SHARED_LIBRARY_PREFIX}${libname}${@LIB@_LIB_SUFFIX}_d${CMAKE_SHARED_LIBRARY_SUFFIX})".replace("@LIB@", lib.upper()))
+                tools.replace_in_file(os.path.join(self._source_subfolder,  lib, "config", "LibraryDefine.cmake"),
+                                      "set(baselibname ${CMAKE_SHARED_LIBRARY_PREFIX}${libname}${CMAKE_SHARED_LIBRARY_SUFFIX})",
+                                      "set(baselibname ${CMAKE_SHARED_LIBRARY_PREFIX}${libname}_d${CMAKE_SHARED_LIBRARY_SUFFIX})")
+
+    def build(self):
+        self._patch_files()
+        cmake = self._configure_cmake()
+        cmake.build()
+
+    def package(self):
+        self.copy("LICENSE.md", src=self._source_subfolder, dst="licenses")
+        cmake = self._configure_cmake()
+        cmake.install()
+        tools.rmdir(os.path.join(self.package_folder, "share"))
+        tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
+        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
+
+    def package_info(self):
+        self.cpp_info.name = "OpenEXR"
+        parsed_version = self.version.split(".")
+        lib_suffix = "-{}_{}".format(parsed_version[0], parsed_version[1])
+        if self.settings.build_type == "Debug":
+            lib_suffix += "_d"
+
+        self.cpp_info.libs = ["IlmImf{}".format(lib_suffix),
+                              "IlmImfUtil{}".format(lib_suffix),
+                              "IlmThread{}".format(lib_suffix),
+                              "Iex{}".format(lib_suffix),
+                              "IexMath{}".format(lib_suffix),
+                              "Imath{}".format(lib_suffix),
+                              "Half{}".format(lib_suffix)]
+        
+        self.cpp_info.includedirs = [os.path.join("include", "OpenEXR"), "include"]
+        if self.options.shared and self.settings.os == "Windows":
+            self.cpp_info.defines.append("OPENEXR_DLL")
+
+        if self.settings.os == "Linux":
+            self.cpp_info.system_libs.append("pthread")


Test patch:
diff --git a/recipes/openexr/2.4.0/test_package/CMakeLists.txt b/recipes/openexr/2.4.0/test_package/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/recipes/openexr/2.4.0/test_package/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 2.8)
+project(test_package)
+
+include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
+conan_basic_setup()
+
+add_executable(${PROJECT_NAME} test_package.cpp)
+target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
+set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
+
diff --git a/recipes/openexr/2.4.0/test_package/comp_short_decode_piz.exr b/recipes/openexr/2.4.0/test_package/comp_short_decode_piz.exr
new file mode 100644
Binary files /dev/null and b/recipes/openexr/2.4.0/test_package/comp_short_decode_piz.exr differ
diff --git a/recipes/openexr/2.4.0/test_package/conanfile.py b/recipes/openexr/2.4.0/test_package/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/openexr/2.4.0/test_package/conanfile.py
@@ -0,0 +1,17 @@
+from conans import ConanFile, CMake
+import os
+
+
+class DefaultNameConan(ConanFile):
+    settings = "os", "compiler", "arch", "build_type"
+    generators = "cmake"
+
+    def build(self):
+        cmake = CMake(self)
+        cmake.configure()
+        cmake.build()
+
+    def test(self):
+        bin_path = os.path.join("bin", "test_package")
+        imgfile = os.path.join(self.source_folder, "comp_short_decode_piz.exr")
+        self.run("{} {}".format(bin_path, imgfile), run_environment=True)
diff --git a/recipes/openexr/2.4.0/test_package/test_package.cpp b/recipes/openexr/2.4.0/test_package/test_package.cpp
new file mode 100644
--- /dev/null
+++ b/recipes/openexr/2.4.0/test_package/test_package.cpp
@@ -0,0 +1,18 @@
+#include <iostream>
+#include <cstdlib>
+
+#include <ImfRgbaFile.h>
+#include <ImfArray.h>
+#include <half.h>
+
+int main (int argc, char *argv[])
+{
+    if (argc < 2)
+        return EXIT_FAILURE;
+    Imf::RgbaInputFile input_file(argv[1]);
+    const Imf::Header& header = input_file.header();
+    size_t width = header.dataWindow().max.x - header.dataWindow().min.x + 1;
+    size_t height = header.dataWindow().max.y - header.dataWindow().min.y + 1;
+    std::cout << "OpenEXR images size is " << width << "x" << height << std::endl;
+    return EXIT_SUCCESS;
+}