Repository: conan-io/conan-center-index

Issue:
[package] poco/all: Poco::Foundation's SharedLibrary::suffix doesn't work cleanly with build_type Debug
### Description

With build_type=Debug specified in profile and building Poco and a shared library through conan, Poco::SharedLibrary::suffix() will return the incorrect platform-specific extension.

This is due to conan creating shared libraries without a ".d" to specify a debug version of a library as builds are separated into different folders.

For context see comment in the Poco header for this function: [SharedLibrary.h:L115](https://github.com/pocoproject/poco/blob/88be66972a07968f027b68860add1d43aa5f135c/Foundation/include/Poco/SharedLibrary.h#L115)

My suggestion is to add `tc.preprocessor_definitions["POCO_NO_SHARED_LIBRARY_DEBUG_SUFFIX"] = "1"` into the recipe for poco. Should a new option for this behaviour be added as well, or should it be added for all builds?

### Package and Environment Details

* Package Name/Version: **poco/1.12.4**
* Operating System+version: Linux Ubuntu 16.04
* Compiler+version: GCC 13
* Docker image: conanio/gcc13-ubuntu16.04
* Conan version: conan 2.0.17
* Python version: Python 3.7.13


### Conan profile

[settings]
arch=x86_64
build_type=Debug
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=13
os=Linux

### Steps to reproduce

conan install -r poco/1.12.4

### Logs

No logs, error is during runtime not build time


Discussion:

Resolving patch:
diff --git a/recipes/poco/all/conanfile.py b/recipes/poco/all/conanfile.py
--- a/recipes/poco/all/conanfile.py
+++ b/recipes/poco/all/conanfile.py
@@ -31,6 +31,7 @@ class PocoConan(ConanFile):
         "enable_active_record": [True, False, "deprecated"],
         "log_debug": [True, False],
         "with_sql_parser": [True, False],
+        "comp_foundation_sharedlibrary_debug_suffix": [True, False],
     }
     default_options = {
         "shared": False,
@@ -39,6 +40,7 @@ class PocoConan(ConanFile):
         "enable_active_record": "deprecated",
         "log_debug": False,
         "with_sql_parser": True,
+        "comp_foundation_sharedlibrary_debug_suffix": True,
     }
 
     _PocoComponent = namedtuple("_PocoComponent", ("option", "default_option", "dependencies", "external_dependencies", "is_lib"))
@@ -127,6 +129,8 @@ def config_options(self):
             del self.options.enable_prometheus
         if Version(self.version) < "1.13.0":
             del self.options.with_sql_parser
+        if self.settings.build_type != "Debug":
+            del self.options.comp_foundation_sharedlibrary_debug_suffix
 
     def configure(self):
         if self.options.enable_active_record != "deprecated":
@@ -250,6 +254,9 @@ def generate(self):
         tc.preprocessor_definitions["POCO_NO_AUTOMATIC_LIBS"] = "1"
         # Picked up from conan v1 CMake wrapper, don't know the rationale
         tc.preprocessor_definitions["XML_DTD"] = "1"
+        # Disable SharedLibrary::suffix() including "d" as part of the platform-specific filename suffix
+        if not self.options.get_safe("comp_foundation_sharedlibrary_debug_suffix", True):
+            tc.preprocessor_definitions["POCO_NO_SHARED_LIBRARY_DEBUG_SUFFIX"] = "1"
         tc.generate()
 
         deps = CMakeDeps(self)


Test patch: