diff --git a/recipes/wineditline/all/CMakeLists.txt b/recipes/wineditline/all/CMakeLists.txt index a173239c53c44..1fedb144d2f6c 100644 --- a/recipes/wineditline/all/CMakeLists.txt +++ b/recipes/wineditline/all/CMakeLists.txt @@ -1,25 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(wineditline_wrapper C) +project(WinEditLineWrapper C) include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() +conan_basic_setup(TARGETS) -set(src source_subfolder/src) - -add_library(edit "${src}/editline.c" "${src}/fn_complete.c" "${src}/history.c") -if(BUILD_SHARED_LIBS) - target_sources(edit PRIVATE "${src}/libedit.def") -endif() - -target_include_directories(edit PRIVATE "${src}") - -include(GNUInstallDirs) - -install( - TARGETS edit - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" -) - -install(DIRECTORY "${src}/editline" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") +add_subdirectory(source_subfolder) diff --git a/recipes/wineditline/all/conandata.yml b/recipes/wineditline/all/conandata.yml index 60b4632ebe2ba..789f36bc66156 100644 --- a/recipes/wineditline/all/conandata.yml +++ b/recipes/wineditline/all/conandata.yml @@ -2,3 +2,7 @@ sources: "2.206": sha256: "2d255c417244e963261dc6171684265f405df030e90ba6e6690a99284d645161" url: https://sourceforge.net/projects/mingweditline/files/wineditline-2.206.zip/download +patches: + "2.206": + - patch_file: patches/0001-fix-cmakelists.patch + base_path: source_subfolder diff --git a/recipes/wineditline/all/conanfile.py b/recipes/wineditline/all/conanfile.py index bc220150a44d9..3888bf2a8557f 100644 --- a/recipes/wineditline/all/conanfile.py +++ b/recipes/wineditline/all/conanfile.py @@ -25,18 +25,17 @@ class WineditlineConan(ConanFile): default_options = { "shared": False, } - - exports_sources = ("CMakeLists.txt",) - - @property - def _source_subfolder(self): - return "source_subfolder" + exports_sources = ("patches/*", "CMakeLists.txt") def validate(self): if self.settings.os != "Windows": message = "wineditline is supported only on Windows." raise ConanInvalidConfiguration(message) + @property + def _source_subfolder(self): + return "source_subfolder" + def source(self): root = self._source_subfolder get_args = self.conan_data["sources"][self.version] @@ -53,24 +52,13 @@ def _configure_cmake(self): return cmake def build(self): - cmake = self._configure_cmake() - cmake.build() + for patch in self.conan_data["patches"][self.version]: + tools.patch(**patch) + self._configure_cmake().build() def package(self): self.copy("COPYING", "licenses", self._source_subfolder) - cmake = self._configure_cmake() - cmake.install() + self._configure_cmake().install() def package_info(self): - name = self.name - info = self.cpp_info - - info.set_property("cmake_file_name", name) - info.set_property("cmake_target_name", f"{name}::{name}") - - info.names.update({ - "cmake_find_package": name, - "cmake_find_package_multi": name, - }) - - info.libs = ["edit"] + self.cpp_info.libs = ["edit"] diff --git a/recipes/wineditline/all/patches/0001-fix-cmakelists.patch b/recipes/wineditline/all/patches/0001-fix-cmakelists.patch new file mode 100644 index 0000000000000..ef01b0ca0616b --- /dev/null +++ b/recipes/wineditline/all/patches/0001-fix-cmakelists.patch @@ -0,0 +1,43 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -1,25 +1,16 @@ +-cmake_minimum_required (VERSION 2.6) +-project (WinEditLine) +-set (WinEditLine_VERSION_MAJOR 2) +-set (WinEditLine_VERSION_MINOR 2) +-if (MSVC AND MSVC_USE_STATIC_RUNTIME) +-foreach(flag_var +- CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE +- CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) +- if(${flag_var} MATCHES "/MD") +- string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") +- endif(${flag_var} MATCHES "/MD") +-endforeach(flag_var) +-endif() +-if(NOT DEFINED LIB_SUFFIX) +- if(CMAKE_SIZEOF_VOID_P MATCHES 4) +- set(LIB_SUFFIX "32") +- else() +- set(LIB_SUFFIX "64") +- endif() +-endif() +-configure_file ( +- "${PROJECT_SOURCE_DIR}/src/config.h.in" +- "${PROJECT_BINARY_DIR}/config.h" ++cmake_minimum_required(VERSION 3.1) ++ ++project(WinEditLine C) ++ ++add_library(edit src/editline.c src/fn_complete.c src/history.c src/libedit.def) ++target_include_directories(edit PRIVATE src) ++ ++include(GNUInstallDirs) ++ ++install( ++ TARGETS edit ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ) +-add_subdirectory (src) ++ ++install(DIRECTORY src/editline DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") diff --git a/recipes/wineditline/all/test_package/CMakeLists.txt b/recipes/wineditline/all/test_package/CMakeLists.txt index 7a1892d6fe492..84a38c545c793 100644 --- a/recipes/wineditline/all/test_package/CMakeLists.txt +++ b/recipes/wineditline/all/test_package/CMakeLists.txt @@ -1,10 +1,10 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -find_package(wineditline REQUIRED CONFIG) - include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") conan_basic_setup(TARGETS) +find_package(wineditline REQUIRED CONFIG) + add_executable(test_package test_package.c) target_link_libraries(test_package PRIVATE wineditline::wineditline)