We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[package] imgui/1.84.1: Shared library does not automatically import global data symbols
### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **imgui/1.84.1**
  * Operating System+version: **Windows 10 21H1 Build 19043.1165**
  * Compiler+version: **Visual Studio 16 (2019)**
  * Docker image: **N/A**
  * Conan version: **conan 1.39.0**
  * Python version: **Python 3.9.6**


### 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
build_type=Release
[options]
[conf]
[build_requires]
[env]
```


### Steps to reproduce (Include if Applicable)
Try to reference any code that uses global data symbols since those need to use `__declspec(dllimport)` when using [`WINDOWS_EXPORT_ALL_SYMBOLS`](https://cmake.org/cmake/help/latest/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.html#windows-export-all-symbols). One example could be using [`ImGuiTextBuffer`](https://github.com/ocornut/imgui/blob/v1.84.1/imgui.h#L2078) (which has `IMGUI_API static char EmptyString[1];`).
The following diff is for ImGui's [`test_package.cpp`](https://github.com/conan-io/conan-center-index/blob/master/recipes/imgui/all/test_package/test_package.cpp) and can reproduce this issue.

```
--- a/recipes/imgui/all/test_package/test_package.cpp
+++ b/recipes/imgui/all/test_package/test_package.cpp
@@ -5,6 +5,9 @@ int main(int, char**)
 {
     ImGuiContext* context =ImGui::CreateContext();
     ImGuiIO& io = ImGui::GetIO();
+	
+    ImGuiTextBuffer textBuffer;
+    textBuffer.append("Hello, ImGui");
 
     // Build atlas
     unsigned char* tex_pixels = NULL;
@@ -20,6 +23,7 @@ int main(int, char**)
 
         static float f = 0.0f;
         ImGui::Text("Hello, world!");
+        ImGui::Text(textBuffer.begin());
         ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
         ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
         ImGui::ShowDemoWindow(NULL);
```

Then, try to create the package with `conan create . imgui/1.84.1@ -o imgui:shared=True`.


### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
test_package.obj : error LNK2019: unresolved external symbol "public: static char * ImGuiTextBuffer::EmptyString" (?Emp
tyString@ImGuiTextBuffer@@2PADA) referenced in function main
```

</details>

I think the simplest solution would be to add something like this

```
if self.options.shared and self.settings.os == "Windows":
    self.cpp_info.defines.append("IMGUI_API=__declspec(dllimport)")
```

I'd be happy to open a PR with this change.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `recipes/imgui/all/conanfile.py`
Content:
```
1 from conans import ConanFile, CMake, tools
2 import os
3 
4 required_conan_version = ">=1.33.0"
5 
6 
7 class IMGUIConan(ConanFile):
8     name = "imgui"
9     url = "https://github.com/conan-io/conan-center-index"
10     homepage = "https://github.com/ocornut/imgui"
11     description = "Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies"
12     topics = ("conan", "imgui", "gui", "graphical")
13     license = "MIT"
14 
15     exports_sources = ["CMakeLists.txt"]
16     generators = "cmake"
17 
18     settings = "os", "arch", "compiler", "build_type"
19     options = {
20         "shared": [True, False],
21          "fPIC": [True, False]
22     }
23     default_options = {
24         "shared": False,
25         "fPIC": True
26     }
27 
28     _cmake = None
29 
30     @property
31     def _source_subfolder(self):
32         return "source_subfolder"
33 
34     def config_options(self):
35         if self.settings.os == "Windows":
36             del self.options.fPIC
37 
38     def configure(self):
39         if self.options.shared:
40             del self.options.fPIC
41 
42     def source(self):
43         tools.get(**self.conan_data["sources"][self.version],
44                   destination=self._source_subfolder, strip_root=True)
45 
46     def _configure_cmake(self):
47         if self._cmake:
48             return self._cmake
49         self._cmake = CMake(self)
50         self._cmake.configure()
51         return self._cmake
52 
53     def build(self):
54         cmake = self._configure_cmake()
55         cmake.build()
56 
57     def package(self):
58         self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder)
59         backends_folder = src=os.path.join(
60             self._source_subfolder,
61             "backends" if tools.Version(self.version) >= "1.80" else "examples"
62         )
63         self.copy(pattern="imgui_impl_*",
64                   dst=os.path.join("res", "bindings"),
65                   src=backends_folder)
66         cmake = self._configure_cmake()
67         cmake.install()
68 
69     def package_info(self):
70         self.cpp_info.libs = ["imgui"]
71         if self.settings.os == "Linux":
72             self.cpp_info.system_libs.append("m")
73         self.cpp_info.srcdirs = [os.path.join("res", "bindings")]
74 
75         bin_path = os.path.join(self.package_folder, "bin")
76         self.output.info("Appending PATH env var with : {}".format(bin_path))
77         self.env_info.PATH.append(bin_path)
78
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/recipes/imgui/all/conanfile.py b/recipes/imgui/all/conanfile.py
--- a/recipes/imgui/all/conanfile.py
+++ b/recipes/imgui/all/conanfile.py
@@ -12,19 +12,18 @@
     topics = ("conan", "imgui", "gui", "graphical")
     license = "MIT"
 
-    exports_sources = ["CMakeLists.txt"]
-    generators = "cmake"
-
     settings = "os", "arch", "compiler", "build_type"
     options = {
         "shared": [True, False],
-         "fPIC": [True, False]
+        "fPIC": [True, False],
     }
     default_options = {
         "shared": False,
-        "fPIC": True
+        "fPIC": True,
     }
 
+    exports_sources = "CMakeLists.txt"
+    generators = "cmake"
     _cmake = None
 
     @property
@@ -56,7 +55,7 @@
 
     def package(self):
         self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder)
-        backends_folder = src=os.path.join(
+        backends_folder = os.path.join(
             self._source_subfolder,
             "backends" if tools.Version(self.version) >= "1.80" else "examples"
         )
@@ -68,6 +67,7 @@
 
     def package_info(self):
         self.cpp_info.libs = ["imgui"]
+        self.cpp_info.defines.append("IMGUI_USER_CONFIG=\"imgui_user_config.h\"")
         if self.settings.os == "Linux":
             self.cpp_info.system_libs.append("m")
         self.cpp_info.srcdirs = [os.path.join("res", "bindings")]

{"golden_diff": "diff --git a/recipes/imgui/all/conanfile.py b/recipes/imgui/all/conanfile.py\n--- a/recipes/imgui/all/conanfile.py\n+++ b/recipes/imgui/all/conanfile.py\n@@ -12,19 +12,18 @@\n     topics = (\"conan\", \"imgui\", \"gui\", \"graphical\")\n     license = \"MIT\"\n \n-    exports_sources = [\"CMakeLists.txt\"]\n-    generators = \"cmake\"\n-\n     settings = \"os\", \"arch\", \"compiler\", \"build_type\"\n     options = {\n         \"shared\": [True, False],\n-         \"fPIC\": [True, False]\n+        \"fPIC\": [True, False],\n     }\n     default_options = {\n         \"shared\": False,\n-        \"fPIC\": True\n+        \"fPIC\": True,\n     }\n \n+    exports_sources = \"CMakeLists.txt\"\n+    generators = \"cmake\"\n     _cmake = None\n \n     @property\n@@ -56,7 +55,7 @@\n \n     def package(self):\n         self.copy(pattern=\"LICENSE.txt\", dst=\"licenses\", src=self._source_subfolder)\n-        backends_folder = src=os.path.join(\n+        backends_folder = os.path.join(\n             self._source_subfolder,\n             \"backends\" if tools.Version(self.version) >= \"1.80\" else \"examples\"\n         )\n@@ -68,6 +67,7 @@\n \n     def package_info(self):\n         self.cpp_info.libs = [\"imgui\"]\n+        self.cpp_info.defines.append(\"IMGUI_USER_CONFIG=\\\"imgui_user_config.h\\\"\")\n         if self.settings.os == \"Linux\":\n             self.cpp_info.system_libs.append(\"m\")\n         self.cpp_info.srcdirs = [os.path.join(\"res\", \"bindings\")]\n", "issue": "[package] imgui/1.84.1: Shared library does not automatically import global data symbols\n### Package and Environment Details (include every applicable attribute)\r\n  * Package Name/Version: **imgui/1.84.1**\r\n  * Operating System+version: **Windows 10 21H1 Build 19043.1165**\r\n  * Compiler+version: **Visual Studio 16 (2019)**\r\n  * Docker image: **N/A**\r\n  * Conan version: **conan 1.39.0**\r\n  * Python version: **Python 3.9.6**\r\n\r\n\r\n### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)\r\n```\r\n[settings]\r\nos=Windows\r\nos_build=Windows\r\narch=x86_64\r\narch_build=x86_64\r\ncompiler=Visual Studio\r\ncompiler.version=16\r\nbuild_type=Release\r\n[options]\r\n[conf]\r\n[build_requires]\r\n[env]\r\n```\r\n\r\n\r\n### Steps to reproduce (Include if Applicable)\r\nTry to reference any code that uses global data symbols since those need to use `__declspec(dllimport)` when using [`WINDOWS_EXPORT_ALL_SYMBOLS`](https://cmake.org/cmake/help/latest/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.html#windows-export-all-symbols). One example could be using [`ImGuiTextBuffer`](https://github.com/ocornut/imgui/blob/v1.84.1/imgui.h#L2078) (which has `IMGUI_API static char EmptyString[1];`).\r\nThe following diff is for ImGui's [`test_package.cpp`](https://github.com/conan-io/conan-center-index/blob/master/recipes/imgui/all/test_package/test_package.cpp) and can reproduce this issue.\r\n\r\n```\r\n--- a/recipes/imgui/all/test_package/test_package.cpp\r\n+++ b/recipes/imgui/all/test_package/test_package.cpp\r\n@@ -5,6 +5,9 @@ int main(int, char**)\r\n {\r\n     ImGuiContext* context =ImGui::CreateContext();\r\n     ImGuiIO& io = ImGui::GetIO();\r\n+\t\r\n+    ImGuiTextBuffer textBuffer;\r\n+    textBuffer.append(\"Hello, ImGui\");\r\n \r\n     // Build atlas\r\n     unsigned char* tex_pixels = NULL;\r\n@@ -20,6 +23,7 @@ int main(int, char**)\r\n \r\n         static float f = 0.0f;\r\n         ImGui::Text(\"Hello, world!\");\r\n+        ImGui::Text(textBuffer.begin());\r\n         ImGui::SliderFloat(\"float\", &f, 0.0f, 1.0f);\r\n         ImGui::Text(\"Application average %.3f ms/frame (%.1f FPS)\", 1000.0f / io.Framerate, io.Framerate);\r\n         ImGui::ShowDemoWindow(NULL);\r\n```\r\n\r\nThen, try to create the package with `conan create . imgui/1.84.1@ -o imgui:shared=True`.\r\n\r\n\r\n### Logs (Include/Attach if Applicable)\r\n<details><summary>Click to expand log</summary>\r\n\r\n```\r\ntest_package.obj : error LNK2019: unresolved external symbol \"public: static char * ImGuiTextBuffer::EmptyString\" (?Emp\r\ntyString@ImGuiTextBuffer@@2PADA) referenced in function main\r\n```\r\n\r\n</details>\r\n\r\nI think the simplest solution would be to add something like this\r\n\r\n```\r\nif self.options.shared and self.settings.os == \"Windows\":\r\n    self.cpp_info.defines.append(\"IMGUI_API=__declspec(dllimport)\")\r\n```\r\n\r\nI'd be happy to open a PR with this change.\n", "before_files": [{"content": "from conans import ConanFile, CMake, tools\nimport os\n\nrequired_conan_version = \">=1.33.0\"\n\n\nclass IMGUIConan(ConanFile):\n    name = \"imgui\"\n    url = \"https://github.com/conan-io/conan-center-index\"\n    homepage = \"https://github.com/ocornut/imgui\"\n    description = \"Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies\"\n    topics = (\"conan\", \"imgui\", \"gui\", \"graphical\")\n    license = \"MIT\"\n\n    exports_sources = [\"CMakeLists.txt\"]\n    generators = \"cmake\"\n\n    settings = \"os\", \"arch\", \"compiler\", \"build_type\"\n    options = {\n        \"shared\": [True, False],\n         \"fPIC\": [True, False]\n    }\n    default_options = {\n        \"shared\": False,\n        \"fPIC\": True\n    }\n\n    _cmake = None\n\n    @property\n    def _source_subfolder(self):\n        return \"source_subfolder\"\n\n    def config_options(self):\n        if self.settings.os == \"Windows\":\n            del self.options.fPIC\n\n    def configure(self):\n        if self.options.shared:\n            del self.options.fPIC\n\n    def source(self):\n        tools.get(**self.conan_data[\"sources\"][self.version],\n                  destination=self._source_subfolder, strip_root=True)\n\n    def _configure_cmake(self):\n        if self._cmake:\n            return self._cmake\n        self._cmake = CMake(self)\n        self._cmake.configure()\n        return self._cmake\n\n    def build(self):\n        cmake = self._configure_cmake()\n        cmake.build()\n\n    def package(self):\n        self.copy(pattern=\"LICENSE.txt\", dst=\"licenses\", src=self._source_subfolder)\n        backends_folder = src=os.path.join(\n            self._source_subfolder,\n            \"backends\" if tools.Version(self.version) >= \"1.80\" else \"examples\"\n        )\n        self.copy(pattern=\"imgui_impl_*\",\n                  dst=os.path.join(\"res\", \"bindings\"),\n                  src=backends_folder)\n        cmake = self._configure_cmake()\n        cmake.install()\n\n    def package_info(self):\n        self.cpp_info.libs = [\"imgui\"]\n        if self.settings.os == \"Linux\":\n            self.cpp_info.system_libs.append(\"m\")\n        self.cpp_info.srcdirs = [os.path.join(\"res\", \"bindings\")]\n\n        bin_path = os.path.join(self.package_folder, \"bin\")\n        self.output.info(\"Appending PATH env var with : {}\".format(bin_path))\n        self.env_info.PATH.append(bin_path)\n", "path": "recipes/imgui/all/conanfile.py"}], "after_files": [{"content": "from conans import ConanFile, CMake, tools\nimport os\n\nrequired_conan_version = \">=1.33.0\"\n\n\nclass IMGUIConan(ConanFile):\n    name = \"imgui\"\n    url = \"https://github.com/conan-io/conan-center-index\"\n    homepage = \"https://github.com/ocornut/imgui\"\n    description = \"Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies\"\n    topics = (\"conan\", \"imgui\", \"gui\", \"graphical\")\n    license = \"MIT\"\n\n    settings = \"os\", \"arch\", \"compiler\", \"build_type\"\n    options = {\n        \"shared\": [True, False],\n        \"fPIC\": [True, False],\n    }\n    default_options = {\n        \"shared\": False,\n        \"fPIC\": True,\n    }\n\n    exports_sources = \"CMakeLists.txt\"\n    generators = \"cmake\"\n    _cmake = None\n\n    @property\n    def _source_subfolder(self):\n        return \"source_subfolder\"\n\n    def config_options(self):\n        if self.settings.os == \"Windows\":\n            del self.options.fPIC\n\n    def configure(self):\n        if self.options.shared:\n            del self.options.fPIC\n\n    def source(self):\n        tools.get(**self.conan_data[\"sources\"][self.version],\n                  destination=self._source_subfolder, strip_root=True)\n\n    def _configure_cmake(self):\n        if self._cmake:\n            return self._cmake\n        self._cmake = CMake(self)\n        self._cmake.configure()\n        return self._cmake\n\n    def build(self):\n        cmake = self._configure_cmake()\n        cmake.build()\n\n    def package(self):\n        self.copy(pattern=\"LICENSE.txt\", dst=\"licenses\", src=self._source_subfolder)\n        backends_folder = os.path.join(\n            self._source_subfolder,\n            \"backends\" if tools.Version(self.version) >= \"1.80\" else \"examples\"\n        )\n        self.copy(pattern=\"imgui_impl_*\",\n                  dst=os.path.join(\"res\", \"bindings\"),\n                  src=backends_folder)\n        cmake = self._configure_cmake()\n        cmake.install()\n\n    def package_info(self):\n        self.cpp_info.libs = [\"imgui\"]\n        self.cpp_info.defines.append(\"IMGUI_USER_CONFIG=\\\"imgui_user_config.h\\\"\")\n        if self.settings.os == \"Linux\":\n            self.cpp_info.system_libs.append(\"m\")\n        self.cpp_info.srcdirs = [os.path.join(\"res\", \"bindings\")]\n\n        bin_path = os.path.join(self.package_folder, \"bin\")\n        self.output.info(\"Appending PATH env var with : {}\".format(bin_path))\n        self.env_info.PATH.append(bin_path)\n", "path": "recipes/imgui/all/conanfile.py"}]}