Repository: conan-io/conan-center-index

Issue:
[package] gdcm/3.0.20: libuuid isn't being found on Mac
### Description

gdcm finds System.framework instead of libuuid::libuuid from conan
"-- Found UUID: /Applications/conan/xcode/13/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/System.framework"

It's probably caused by custom FindUUID.cmake
https://github.com/malaterre/GDCM/blob/v3.0.20/CMake/FindUUID.cmake

### Package and Environment Details

* Package Name/Version: **gdcm/3.0.20**
* Operating System+version: **macOS**
* Compiler+version: **Xcode 13**
* Docker image: ****
* Conan version: ****
* Python version: ****


### Conan profile

Configuration (profile_host):
[settings]
arch=armv8
build_type=Debug
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=13.0
os=Macos
[options]
gdcm:shared=True
[build_requires]
[env]
[conf]
tools.system.package_manager:mode=install
tools.system.package_manager:sudo=True
tools.apple:sdk_path=/Applications/conan/xcode/13/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk

Configuration (profile_build):
[settings]
arch=x86_64
build_type=Debug
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=13.0
os=Macos
[options]
gdcm:shared=True
[build_requires]
[env]
[conf]
tools.system.package_manager:mode=install
tools.system.package_manager:sudo=True
tools.apple:sdk_path=/Applications/conan/xcode/13/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk

### Steps to reproduce

conan install -r conancenter gdcm/3.0.20@  --build=gdcm -pr:h host_profile -pr:b build_profile

### Logs

https://c3i.jfrog.io/c3i/misc/logs/pr/14362/4-configs/macos-m1-clang/gdcm/3.0.20//eb93c512dafef9e324991a743e80e016d97f6271-build.txt

<details><summary>Click to expand log</summary>

```
********************************************************************************
conan install gdcm/3.0.20@#a730813d4bfea632ea259e16568d2846 --build=gdcm -pr:h /Users/jenkins/w/prod/BuildSingleReference/126404/bb7e66f6-f748-4711-a55c-aca40dd17c75/profile_osx_130_libcpp_apple-clang_debug_armv8.gdcm-shared-True.txt -c:h tools.system.package_manager:mode=install -c:h tools.system.package_manager:sudo=True -c:h tools.apple:sdk_path=/Applications/conan/xcode/13/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -pr:b /Users/jenkins/w/prod/BuildSingleReference/126404/bb7e66f6-f748-4711-a55c-aca40dd17c75/profile_osx_130_libcpp_apple-clang_debug_64.gdcm-shared-True.txt -c:b tools.system.package_manager:mode=install -c:b tools.system.package_manager:sudo=True -c:b tools.apple:sdk_path=/Applications/conan/xcode/13/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk
********************************************************************************
Auto detecting your dev setup to initialize the default profile (/Users/jenkins/w/prod/BuildSingleReference/.conan/profiles/default)
Found apple-clang 13.0
apple-clang>=13, using the major as version
Default settings
	os=Macos
	os_build=Macos
	arch=x86_64
	arch_build=x86_64
	compiler=apple-clang
	compiler.version=13
	compiler.libcxx=libc++
	build_type=Release
*** You can change them in /Users/jenkins/w/prod/BuildSingleReference/.conan/profiles/default ***
*** Or override with -s compiler='other' -s ...s***


Configuration (profile_host):
[settings]
arch=armv8
build_type=Debug
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=13.0
os=Macos
[options]
gdcm:shared=True
[build_requires]
[env]
[conf]
tools.system.package_manager:mode=install
tools.system.package_manager:sudo=True
tools.apple:sdk_path=/Applications/conan/xcode/13/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk

Configuration (profile_build):
[settings]
arch=x86_64
build_type=Debug
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=13.0
os=Macos
[options]
gdcm:shared=True
[build_requires]
[env]
[conf]
tools.system.package_manager:mode=install
tools.system.package_manager:sudo=True
tools.apple:sdk_path=/Applications/conan/xcode/13/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk

expat/2.5.0: Not found in local cache, looking in remotes...
expat/2.5.0: Trying with 'conan-center'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
expat/2.5.0: Downloaded recipe revision 98829cfd97ab55bceed0911eb7825a72
openjpeg/2.5.0: Not found in local cache, looking in remotes...
openjpeg/2.5.0: Trying with 'conan-center'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
openjpeg/2.5.0: Downloaded recipe revision cb3ca9c879e991ad313caa16d7e04169
zlib/1.2.13: Not found in local cache, looking in remotes...
zlib/1.2.13: Trying with 'conan-center'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
zlib/1.2.13: Downloaded recipe revision 13c96f538b52e1600c40b88994de240f
libuuid/1.0.3: Not found in local cache, looking in remotes...
libuuid/1.0.3: Trying with 'conan-center'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
libuuid/1.0.3: Downloaded recipe revision c1e05c4dd1415876e0d110d7fff47244
libiconv/1.17: Not found in local cache, looking in remotes...
libiconv/1.17: Trying with 'conan-center'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
libiconv/1.17: Downloaded recipe revision 2657191c084cc856aa0429c2bdb5a0bf
json-c/0.16: Not found in local cache, looking in remotes...
json-c/0.16: Trying with 'conan-center'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
json-c/0.16: Downloaded recipe revision ec2608d5054402fac0c1b6038acba400
openssl/1.1.1s: Not found in local cache, looking in remotes...
openssl/1.1.1s: Trying with 'conan-center'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
openssl/1.1.1s: Downloaded recipe revision 4cdbdf05388774e8de45fa18c9468286
gdcm/3.0.20: Forced build from source
Installing package: gdcm/3.0.20
Requirements
    expat/2.5.0 from 'conan-center' - Downloaded
    gdcm/3.0.20 from local cache - Cache
    json-c/0.16 from 'conan-center' - Downloaded
    libiconv/1.17 from 'conan-center' - Downloaded
    libuuid/1.0.3 from 'conan-center' - Downloaded
    openjpeg/2.5.0 from 'conan-center' - Downloaded
    openssl/1.1.1s from 'conan-center' - Downloaded
    zlib/1.2.13 from 'conan-center' - Downloaded
Packages
    expat/2.5.0:8c3bf58f5a1c42c3db962024098ad6bfe7fd5e94 - Download
    gdcm/3.0.20:eb93c512dafef9e324991a743e80e016d97f6271 - Build
    json-c/0.16:3558c54d13382045caaf9174821b7c2ba01fc8bc - Download
    libiconv/1.17:3558c54d13382045caaf9174821b7c2ba01fc8bc - Download
    libuuid/1.0.3:3558c54d13382045caaf9174821b7c2ba01fc8bc - Download
    openjpeg/2.5.0:3558c54d13382045caaf9174821b7c2ba01fc8bc - Download
    openssl/1.1.1s:3558c54d13382045caaf9174821b7c2ba01fc8bc - Download
    zlib/1.2.13:3558c54d13382045caaf9174821b7c2ba01fc8bc - Download

Cross-build from 'Macos:x86_64' to 'Macos:armv8'
Installing (downloading, building) binaries...
expat/2.5.0: Retrieving package 8c3bf58f5a1c42c3db962024098ad6bfe7fd5e94 from remote 'conan-center' 
Downloading conanmanifest.txt
Downloading conaninfo.txt
Downloading conan_package.tgz
expat/2.5.0: Package installed 8c3bf58f5a1c42c3db962024098ad6bfe7fd5e94
expat/2.5.0: Downloaded package revision e6fe76494007ea26bd658fe1c397e6d0
json-c/0.16: Retrieving package 3558c54d13382045caaf9174821b7c2ba01fc8bc from remote 'conan-center' 
Downloading conanmanifest.txt
Downloading conaninfo.txt
Downloading conan_package.tgz
json-c/0.16: Package installed 3558c54d13382045caaf9174821b7c2ba01fc8bc
json-c/0.16: Downloaded package revision 0543a5f7c312a520f4d2500e7d4046b0
libiconv/1.17: Retrieving package 3558c54d13382045caaf9174821b7c2ba01fc8bc from remote 'conan-center' 
Downloading conanmanifest.txt
Downloading conaninfo.txt
Downloading conan_package.tgz
libiconv/1.17: Package installed 3558c54d13382045caaf9174821b7c2ba01fc8bc
libiconv/1.17: Downloaded package revision fb6dcdf411be4287e4682ff605fae868
libuuid/1.0.3: Retrieving package 3558c54d13382045caaf9174821b7c2ba01fc8bc from remote 'conan-center' 
Downloading conanmanifest.txt
Downloading conaninfo.txt
Downloading conan_package.tgz
libuuid/1.0.3: Package installed 3558c54d13382045caaf9174821b7c2ba01fc8bc
libuuid/1.0.3: Downloaded package revision e743e256f3d4bc67b2aab25a7497cfdd
openjpeg/2.5.0: Retrieving package 3558c54d13382045caaf9174821b7c2ba01fc8bc from remote 'conan-center' 
Downloading conanmanifest.txt
Downloading conaninfo.txt
Downloading conan_package.tgz
openjpeg/2.5.0: Package installed 3558c54d13382045caaf9174821b7c2ba01fc8bc
openjpeg/2.5.0: Downloaded package revision 0a22c0259417a18f9012f1664f85c620
openssl/1.1.1s: Retrieving package 3558c54d13382045caaf9174821b7c2ba01fc8bc from remote 'conan-center' 
Downloading conanmanifest.txt
Downloading conaninfo.txt
Downloading conan_package.tgz
openssl/1.1.1s: Package installed 3558c54d13382045caaf9174821b7c2ba01fc8bc
openssl/1.1.1s: Downloaded package revision e5df0cbb5c13b60a999229ac74e9950f
zlib/1.2.13: Retrieving package 3558c54d13382045caaf9174821b7c2ba01fc8bc from remote 'conan-center' 
Downloading conanmanifest.txt
Downloading conaninfo.txt
Downloading conan_package.tgz
zlib/1.2.13: Package installed 3558c54d13382045caaf9174821b7c2ba01fc8bc
zlib/1.2.13: Downloaded package revision a36800b8a7116397522311c819ab4914
[HOOK - conan-center.py] pre_source(): [IMMUTABLE SOURCES (KB-H010)] OK
gdcm/3.0.20: Configuring sources in /Users/jenkins/w/prod/BuildSingleReference/.conan/data/gdcm/3.0.20/_/_/source/src
gdcm/3.0.20: 
[HOOK - conan-center.py] post_source(): [LIBCXX MANAGEMENT (KB-H011)] OK
[HOOK - conan-center.py] post_source(): [CPPSTD MANAGEMENT (KB-H022)] OK
[HOOK - conan-center.py] post_source(): [SHORT_PATHS USAGE (KB-H066)] OK
gdcm/3.0.20: Copying sources to build folder
gdcm/3.0.20: Building your package in /Users/jenkins/w/prod/BuildSingleReference/.conan/data/gdcm/3.0.20/_/_/build/eb93c512dafef9e324991a743e80e016d97f6271
gdcm/3.0.20: Generator txt created conanbuildinfo.txt
gdcm/3.0.20: Calling generate()
gdcm/3.0.20: Preset 'debug' added to CMakePresets.json. Invoke it manually using 'cmake --preset debug'
gdcm/3.0.20: If your CMake version is not compatible with CMakePresets (<3.19) call cmake like: 'cmake <path> -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=/Users/jenkins/w/prod/BuildSingleReference/.conan/data/gdcm/3.0.20/_/_/build/eb93c512dafef9e324991a743e80e016d97f6271/build/generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Debug'
gdcm/3.0.20: Aggregating env generators
[HOOK - conan-center.py] pre_build(): [FPIC MANAGEMENT (KB-H007)] 'fPIC' option not found
[HOOK - conan-center.py] pre_build(): [FPIC MANAGEMENT (KB-H007)] OK
gdcm/3.0.20: Calling build()
gdcm/3.0.20: Apply patch (portability): fix symbol export for gdcmcharls
gdcm/3.0.20: Apply patch (conan): fix variable names for openjpeg
gdcm/3.0.20: Apply patch (conan): enforce usage of FindEXPAT.cmake
gdcm/3.0.20: Apply patch (conan): skip check_cxx_source_compiles usage for openssl
gdcm/3.0.20: Apply patch (conan): skip check_cxx_source_compiles usage for json-c
gdcm/3.0.20: CMake command: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/jenkins/w/prod/BuildSingleReference/.conan/data/gdcm/3.0.20/_/_/build/eb93c512dafef9e324991a743e80e016d97f6271/build/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/Users/jenkins/w/prod/BuildSingleReference/.conan/data/gdcm/3.0.20/_/_/package/eb93c512dafef9e324991a743e80e016d97f6271" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Debug" "/Users/jenkins/w/prod/BuildSingleReference/.conan/data/gdcm/3.0.20/_/_/build/eb93c512dafef9e324991a743e80e016d97f6271/src"

----Running------
> cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/jenkins/w/prod/BuildSingleReference/.conan/data/gdcm/3.0.20/_/_/build/eb93c512dafef9e324991a743e80e016d97f6271/build/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/Users/jenkins/w/prod/BuildSingleReference/.conan/data/gdcm/3.0.20/_/_/package/eb93c512dafef9e324991a743e80e016d97f6271" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Debug" "/Users/jenkins/w/prod/BuildSingleReference/.conan/data/gdcm/3.0.20/_/_/build/eb93c512dafef9e324991a743e80e016d97f6271/src"
-----------------
-- Using Conan toolchain: /Users/jenkins/w/prod/BuildSingleReference/.conan/data/gdcm/3.0.20/_/_/build/eb93c512dafef9e324991a743e80e016d97f6271/build/generators/conan_toolchain.cmake
-- Conan toolchain: Setting BUILD_SHARED_LIBS = ON
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- The C compiler identification is AppleClang 13.0.0.13000029
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/conan/xcode/13/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/conan/xcode/13/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Conan: Target declared 'openjp2'
-- Conan: Target declared 'ZLIB::ZLIB'
-- Conan: Component target declared 'OpenSSL::Crypto'
-- Conan: Component target declared 'OpenSSL::SSL'
-- Conan: Target declared 'openssl::openssl'
-- Conan: Including build module from '/Users/jenkins/w/prod/BuildSingleReference/.conan/data/openssl/1.1.1s/_/_/package/3558c54d13382045caaf9174821b7c2ba01fc8bc/lib/cmake/conan-official-openssl-variables.cmake'
-- Found UUID: /Applications/conan/xcode/13/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/System.framework
-- Conan: Target declared 'EXPAT::EXPAT'
-- Found EXPAT: 2.5.0 (found version "2.5.0") 
-- Found JSON: /Users/jenkins/w/prod/BuildSingleReference/.conan/data/json-c/0.16/_/_/package/3558c54d13382045caaf9174821b7c2ba01fc8bc/lib/libjson-c.a  
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for strsignal
-- Looking for strsignal - found
-- Looking for include file sys/time.h
-- Looking for include file sys/time.h - found
-- Looking for include files sys/time.h, winsock.h
-- Looking for include files sys/time.h, winsock.h - not found
-- Looking for include files sys/time.h, byteswap.h
-- Looking for include files sys/time.h, byteswap.h - not found
-- Looking for rpc.h
-- Looking for rpc.h - not found
-- Looking for langinfo.h
-- Looking for langinfo.h - found
-- Looking for nl_langinfo
-- Looking for nl_langinfo - found
-- Looking for strcasecmp
-- Looking for strcasecmp - found
-- Looking for strncasecmp
-- Looking for strncasecmp - found
-- Looking for strptime
-- Looking for strptime - found
-- Looking for _stricmp
-- Looking for _stricmp - not found
-- Looking for _strnicmp
-- Looking for _strnicmp - not found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Performing Test GDCM_CXX_HAS_FUNCTION
-- Performing Test GDCM_CXX_HAS_FUNCTION - Success
-- Performing Test GDCM_HAVE_WCHAR_IFSTREAM
-- Performing Test GDCM_HAVE_WCHAR_IFSTREAM - Failed
-- Performing Test GDCM_HAVE_CODECVT
-- Performing Test GDCM_HAVE_CODECVT - Success
-- Conan: Target declared 'Iconv::Iconv'
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jenkins/w/prod/BuildSingleReference/.conan/data/gdcm/3.0.20/_/_/build/eb93c512dafef9e324991a743e80e016d97f6271/build/Debug
gdcm/3.0.20: CMake command: cmake --build "/Users/jenkins/w/prod/BuildSingleReference/.conan/data/gdcm/3.0.20/_/_/build/eb93c512dafef9e324991a743e80e016d97f6271/build/Debug" '--' '-j4'
...
```

</details>



Discussion:

Resolving patch:
diff --git a/recipes/gdcm/all/conanfile.py b/recipes/gdcm/all/conanfile.py
--- a/recipes/gdcm/all/conanfile.py
+++ b/recipes/gdcm/all/conanfile.py
@@ -15,6 +15,7 @@
 
 class GDCMConan(ConanFile):
     name = "gdcm"
+    package_type = "library"
     description = "C++ library for DICOM medical files"
     license = "BSD-3-Clause"
     url = "https://github.com/conan-io/conan-center-index"
@@ -66,9 +67,9 @@ def requirements(self):
             self.requires("openssl/1.1.1s")
 
     def validate(self):
-        if self.info.settings.compiler.get_safe("cppstd"):
+        if self.settings.compiler.get_safe("cppstd"):
             check_min_cppstd(self, self._min_cppstd)
-        if is_msvc_static_runtime(self) and self.info.options.shared:
+        if is_msvc_static_runtime(self) and self.options.shared:
             raise ConanInvalidConfiguration(f"{self.ref} does not support shared and static runtime together.")
 
     def source(self):
@@ -93,8 +94,12 @@ def generate(self):
         deps = CMakeDeps(self)
         deps.generate()
 
-    def build(self):
+    def _patch_sources(self):
         apply_conandata_patches(self)
+        rm(self, "Find*.cmake", os.path.join(self.source_folder, "CMake"))
+
+    def build(self):
+        self._patch_sources()
         cmake = CMake(self)
         cmake.configure()
         cmake.build()


Test patch: