Repository: conan-io/conan-center-index

Issue:
[package] rmlui/4.3: build failure Visual Studio 17 2022
<!-- 
  Please don't forget to update the issue title.
  Include all applicable information to help us reproduce your problem.
-->

### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **rmlui/4.3**
  * Operating System+version: **Windows 11**
  * Compiler+version: **MSVC 2022**
  * Conan version: **conan 1.45.0**
  * Python version: **Python 3.8.2**


### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)
```
Configuration for profile default:

[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=17
build_type=Release
[options]
[conf]
[build_requires]
[env]
```


### Steps to reproduce (Include if Applicable)



### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
rmlui/4.3: Calling build()
CMake Error: Could not create named generator Visual Studio 17 2022

Generators
  Visual Studio 16 2019        = Generates Visual Studio 2019 project files.
                                 Use -A option to specify architecture.
  Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 9 2008 [arch]  = Generates Visual Studio 2008 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Borland Makefiles            = Generates Borland makefiles.
* NMake Makefiles              = Generates NMake makefiles.
  NMake Makefiles JOM          = Generates JOM makefiles.
  MSYS Makefiles               = Generates MSYS makefiles.
  MinGW Makefiles              = Generates a make file for use with
                                 mingw32-make.
  Green Hills MULTI            = Generates Green Hills MULTI files
                                 (experimental, work-in-progress).
  Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja                        = Generates build.ninja files.
  Ninja Multi-Config           = Generates build-<Config>.ninja files.
  Watcom WMake                 = Generates Watcom WMake makefiles.
  CodeBlocks - MinGW Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles JOM
                               = Generates CodeBlocks project files.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - MinGW Makefiles   = Generates CodeLite project files.
  CodeLite - NMake Makefiles   = Generates CodeLite project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    = Generates CodeLite project files.
  Eclipse CDT4 - NMake Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - MinGW Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
  Kate - MinGW Makefiles       = Generates Kate project files.
  Kate - NMake Makefiles       = Generates Kate project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Sublime Text 2 - MinGW Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - NMake Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.

rmlui/4.3: 
rmlui/4.3: WARN: Package binary is corrupted, removing: 997a9da73b74de3fc4335270b6726b7d30fad1ca
rmlui/4.3: WARN: Build folder is dirty, removing it: C:\Users\Konrad\.conan\data\rmlui\4.3\_\_\build\997a9da73b74de3fc4335270b6726b7d30fad1ca
WARN: replace_in_file didn't find pattern 'FREETYPE_FOUND' in 'source_subfolder\CMakeLists.txt' file.
WARN: replace_in_file didn't find pattern 'FREETYPE_LINK_DIRS' in 'source_subfolder\CMakeLists.txt' file.
WARN: replace_in_file didn't find pattern 'FREETYPE_LIBRARY' in 'source_subfolder\CMakeLists.txt' file.
WARN: replace_in_file didn't find pattern 'LUA_FOUND' in 'source_subfolder\CMakeLists.txt' file.
rmlui/4.3: ERROR: Package '997a9da73b74de3fc4335270b6726b7d30fad1ca' build failed
rmlui/4.3: WARN: Build folder C:\Users\Konrad\.conan\data\rmlui\4.3\_\_\build\997a9da73b74de3fc4335270b6726b7d30fad1ca
ERROR: rmlui/4.3: Error in build() method, line 148
	self._configure_cmake().build()
while calling '_configure_cmake', line 112
	self._cmake.configure()
	ConanException: Error 1 while executing cd C:\Users\Konrad\.conan\data\rmlui\4.3\_\_\build\997a9da73b74de3fc4335270b6726b7d30fad1ca && cmake -G "Visual Studio 17 2022" -A "x64" -DCONAN_LINK_RUNTIME="/MDd" -DCONAN_CMAKE_CXX_STANDARD="17" -DCONAN_CMAKE_CXX_EXTENSIONS="OFF" -DCONAN_STD_CXX_FLAG="/std:c++17" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="Visual Studio" -DCONAN_COMPILER_VERSION="17" -DCONAN_CXX_FLAGS="/MP16" -DCONAN_C_FLAGS="/MP16" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="C:\Users\Konrad\.conan\data\rmlui\4.3\_\_\package\997a9da73b74de3fc4335270b6726b7d30fad1ca" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCMAKE_MODULE_PATH="C:/Users/Konrad/.conan/data/rmlui/4.3/_/_/build/997a9da73b74de3fc4335270b6726b7d30fad1ca" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -DBUILD_LUA_BINDINGS="False" -DBUILD_SAMPLES="False" -DCUSTOM_CONFIGURATION="True" -DCUSTOM_INCLUDE_DIRS="C:\Users\Konrad\.conan\data\robin-hood-hashing\3.11.3\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include" -DDISABLE_RTTI_AND_EXCEPTIONS="True" -DENABLE_PRECOMPILED_HEADERS="True" -DENABLE_TRACY_PROFILING="False" -DMATRIX_ROW_MAJOR="False" -DNO_FONT_INTERFACE_DEFAULT="False" -DNO_THIRDPARTY_CONTAINERS="False" -Wno-dev C:\Users\Konrad\.conan\data\rmlui\4.3\_\_\build\997a9da73b74de3fc4335270b6726b7d30fad1ca
CMake Error at cmake-build-debug/conan.cmake:638 (message):
  Conan install failed='1'
Call Stack (most recent call first):
  CMakeLists.txt:66 (conan_cmake_install)

```

</details>



Discussion:
@ZombieRaccoon Looking at the discussion on the RmlUI repo it seems like you implemented the package. Maybe you could take a look at this and try to fix this issue. 

I have a bit of experience and think the issue is coming because you directly require cmake with this line:
```py
build_requires = ["cmake/3.20.0"]
```  
while other libs like szip (https://github.com/conan-io/conan-center-index/blob/master/recipes/szip/all/conanfile.py) are just using the cmake generator like this:
```py
generators = "cmake"
_cmake = None
```
Doing it the szip way however requires the user to have cmake installed. So your solution is more ideal and elegant but since the cmake version on conan seems very badly maintained (still no vs2022 support in the most recent version) and most developers have cmake installed anyways it might be considerable to remove this dependency. I tried to modify and debug the RmlUI conanfile on my machine but since i have no experience with writing conan server recipies i didn't got it working (Some source related error in the `_patch_sources` function...)

Would be very nice if you could look at this since this exact issue is also holding me back to integrate RmlUI into my project. Thanks in advance!
@Ohjurot I'll make sure to take a look at it. My schedule is a bit tight, but I'll try to do so on the weekend. A word of advice: if you care about speeding up your builds by using binary packages, then VS 2022 still isn't supported in that regard (https://github.com/conan-io/conan-center-index/blob/master/docs/supported_platforms_and_configurations.md) and you might want to stick to VS 2019.

Resolving patch:
diff --git a/recipes/rmlui/4.x/conanfile.py b/recipes/rmlui/4.x/conanfile.py
--- a/recipes/rmlui/4.x/conanfile.py
+++ b/recipes/rmlui/4.x/conanfile.py
@@ -29,7 +29,7 @@ class RmluiConan(ConanFile):
         "with_lua_bindings": False,
         "with_thirdparty_containers": True
     }
-    build_requires = ["cmake/3.20.0"]
+    build_requires = ["cmake/3.23.2"]
     exports_sources = ["CMakeLists.txt"]
     generators = ["cmake", "cmake_find_package"]
 


Test patch: