Repository: conan-io/conan-center-index

Issue:
Add dcmtk version 3.6.8
Specify library name and version:  **dcmtk/3.6.8**

<!-- This is also a good place to share with all of us **why you are submitting this PR** (specially if it is a new addition to ConanCenter): is it a dependency of other libraries you want to package? Are you the author of the library? Thanks! -->


---

- [X] I've read the [contributing guidelines](https://github.com/conan-io/conan-center-index/blob/master/CONTRIBUTING.md).
- [X] I've used a [recent](https://github.com/conan-io/conan/releases/latest) Conan client version close to the [currently deployed](https://github.com/conan-io/conan-center-index/blob/master/.c3i/config_v1.yml#L6).
- [X] I've tried at least one configuration locally with the [conan-center hook](https://github.com/conan-io/hooks.git) activated.



Discussion:
### Conan v1 pipeline :x:

Sorry, the build is only launched for Access Request users. You can request access [writing in this issue](https://github.com/conan-io/conan-center-index/issues/4).

----------

### Conan v2 pipeline :x:

> **Note**: Conan v2 builds are now mandatory. Please read our [discussion](https://github.com/conan-io/conan-center-index/discussions/19104) about it.

The v2 pipeline failed. Please, review the errors and note this is required for pull requests to be merged. In case this recipe is still not ported to Conan 2.x, please, ping `@conan-io/barbarians` on the PR and we will help you.

<details>

<summary> See details: </summary>

Sorry, the build is only launched for Access Request users. You can request access [writing in this issue](https://github.com/conan-io/conan-center-index/issues/4).

</details>

Resolving patch:
diff --git a/recipes/dcmtk/all/conanfile.py b/recipes/dcmtk/all/conanfile.py
--- a/recipes/dcmtk/all/conanfile.py
+++ b/recipes/dcmtk/all/conanfile.py
@@ -3,10 +3,11 @@
 
 from conan import ConanFile
 from conan.errors import ConanInvalidConfiguration
-from conan.tools.build import cross_building
+from conan.tools.build import cross_building, check_min_cppstd
 from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
 from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir, save
 from conan.tools.microsoft import is_msvc, is_msvc_static_runtime
+from conan.tools.scm import Version
 
 required_conan_version = ">=1.54.0"
 
@@ -114,10 +115,11 @@ def package_id(self):
         del self.info.options.external_dictionary
 
     def validate(self):
-        if hasattr(self, "settings_build") and cross_building(self) and \
-           self.settings.os == "Macos" and self.settings.arch == "armv8":
+        if self.settings.compiler.cppstd:
+            check_min_cppstd(self, 11)
+        if hasattr(self, "settings_build") and cross_building(self) and self.settings.os == "Macos":
             # FIXME: Probable issue with flags, build includes header 'mmintrin.h'
-            raise ConanInvalidConfiguration("Cross building to Macos M1 is not supported (yet)")
+            raise ConanInvalidConfiguration("Cross building on Macos is not supported (yet)")
 
     def source(self):
         get(self, **self.conan_data["sources"][self.version], strip_root=True)
@@ -287,7 +289,7 @@ def tcpwrappers():
         def xml2():
             return ["libxml2::libxml2"] if self.options.with_libxml2 else []
 
-        return {
+        components = {
             "ofstd"   : charset_conversion(),
             "oflog"   : ["ofstd"],
             "dcmdata" : ["ofstd", "oflog"] + zlib(),
@@ -314,7 +316,15 @@ def xml2():
             "dcmseg"  : ["dcmfg", "dcmiod", "dcmdata", "ofstd", "oflog"],
             "dcmtract": ["dcmiod", "dcmdata", "ofstd", "oflog"],
             "dcmpmap" : ["dcmfg", "dcmiod", "dcmdata", "ofstd", "oflog"],
+            "dcmect"  : ["dcmfg", "dcmiod", "dcmdata", "ofstd", "oflog"],
         }
+        if Version(self.version) >= "3.6.8":
+            components["dcmxml"] = ["dcmdata", "ofstd", "oflog"] + zlib() + xml2()
+            components["oficonv"] = []
+            components["dcmpstat"] += ["dcmiod"]
+            components["i2d"] += ["dcmxml"]
+            components["ofstd"] += ["oficonv"]
+        return components
 
     @property
     def _dcm_datadictionary_path(self):
@@ -326,7 +336,7 @@ def package_info(self):
 
         for target_lib, requires in self._dcmtk_components.items():
             self.cpp_info.components[target_lib].set_property("cmake_target_name", f"DCMTK::{target_lib}")
-            # Before 3.6.7, targets were not namespaced, therefore they are also exposed for conveniency
+            # Before 3.6.7, targets were not namespaced, therefore they are also exposed for convenience
             self.cpp_info.components[target_lib].set_property("cmake_target_aliases", [target_lib])
 
             self.cpp_info.components[target_lib].libs = [target_lib]
@@ -337,14 +347,24 @@ def package_info(self):
             self.cpp_info.components[target_lib].build_modules["cmake_find_package"] = [self._module_file_rel_path]
             self.cpp_info.components[target_lib].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path]
 
+            if is_msvc(self):
+                # Required for the __cplusplus check at
+                # https://github.com/DCMTK/dcmtk/blob/DCMTK-3.6.8/config/include/dcmtk/config/osconfig.h.in#L1489
+                self.cpp_info.components[target_lib].cxxflags.append("/Zc:__cplusplus")
+
+        system_libs = []
         if self.settings.os == "Windows":
-            self.cpp_info.components["ofstd"].system_libs.extend([
-                "iphlpapi", "ws2_32", "netapi32", "wsock32"
-            ])
+            system_libs = ["iphlpapi", "ws2_32", "netapi32", "wsock32"]
         elif self.settings.os in ["Linux", "FreeBSD"]:
-            self.cpp_info.components["ofstd"].system_libs.append("m")
+            system_libs = ["m", "nsl"]
             if self.options.with_multithreading:
-                self.cpp_info.components["ofstd"].system_libs.append("pthread")
+                system_libs.append("pthread")
+            if Version(self.version) >= "3.6.8":
+                system_libs.append("rt")
+        if Version(self.version) >= "3.6.8":
+            self.cpp_info.components["oficonv"].system_libs = system_libs
+        else:
+            self.cpp_info.components["ofstd"].system_libs = system_libs
 
         if self.options.default_dict == "external":
             dcmdictpath = os.path.join(self._dcm_datadictionary_path, "dcmtk", "dicom.dic")


Test patch: