Repository: conan-io/conan-center-index

Issue:
[package] jbig/20160605: Fails to build on iOS
<!-- 
  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: **jbig/20160605**
  * Operating System+version: **iOS 11.0**
  * Compiler+version: **apple-clang 11.0**
  * Conan version: **conan 1.29.2**
  * Python version: **Python 3.8.5**

### Conan profile
```
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=apple-clang
compiler.cppstd=17
compiler.libcxx=libc++
compiler.version=11.0
os=iOS
os.version=11.0
os_build=Macos
[options]
[build_requires]
*: darwin-toolchain/1.0.8@theodelrieu/stable
[env]
```


### Steps to reproduce (Include if Applicable)

`conan install jbig/20160605@ --profile ios --build=missing`

### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
CMake Error at CMakeLists.txt:31 (install):
  install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable
  target "jbgtopbm".
```

</details>

I would suggest adding an option that disables the `pbmtojbg` and `jbgtopbm` targets from being generated. The recipe could define individual `build_` options for each, which other packages do, or go with a more generically named option that enables/disables both. For reference, `sqlite3`, `bzip2`, and `spirv-cross` have a `build_executable` option, while `glslang` has a `build_executables` option. 


Discussion:

Resolving patch:
diff --git a/recipes/jbig/all/conanfile.py b/recipes/jbig/all/conanfile.py
--- a/recipes/jbig/all/conanfile.py
+++ b/recipes/jbig/all/conanfile.py
@@ -13,8 +13,18 @@ class ConanJBig(ConanFile):
     exports_sources = ['CMakeLists.txt', "*.patch"]
     generators = 'cmake'
     settings = "os", "arch", "compiler", "build_type"
-    options = {"shared": [True, False], "fPIC": [True, False]}
-    default_options = {"shared": False, "fPIC": True}
+    options = {
+        "shared": [True, False],
+        "fPIC": [True, False],
+        "build_executables": [True, False]
+    }
+    default_options = {
+        "shared": False,
+        "fPIC": True,
+        "build_executables": True
+    }
+
+    _cmake = None
 
     @property
     def _source_subfolder(self):
@@ -38,9 +48,13 @@ def configure(self):
         del self.settings.compiler.cppstd
 
     def _configure_cmake(self):
-        cmake = CMake(self)
-        cmake.configure(build_folder=self._build_subfolder)
-        return cmake
+        if self._cmake:
+            return self._cmake
+
+        self._cmake = CMake(self)
+        self._cmake.definitions["BUILD_EXECUTABLES"] = self.options.build_executables
+        self._cmake.configure(build_folder=self._build_subfolder)
+        return self._cmake
 
     def build(self):
         for patch in self.conan_data["patches"][self.version]:
@@ -54,9 +68,11 @@ def package(self):
         cmake.install()
 
     def package_info(self):
-        bindir = os.path.join(self.package_folder, "bin")
-        self.output.info("Appending PATH environment variable: {}".format(bindir))
-        self.env_info.PATH.append(bindir)
         self.cpp_info.libs = [self.name]
         if self.options.shared and self.settings.compiler == "Visual Studio":
             self.cpp_info.defines = ["_JBIGDLL_"]
+
+        if self.options.build_executables:
+            bin_path = os.path.join(self.package_folder, "bin")
+            self.output.info("Appending PATH environment variable: {}".format(bin_path))
+            self.env_info.PATH.append(bin_path)


Test patch:
diff --git a/recipes/jbig/all/test_package/CMakeLists.txt b/recipes/jbig/all/test_package/CMakeLists.txt
--- a/recipes/jbig/all/test_package/CMakeLists.txt
+++ b/recipes/jbig/all/test_package/CMakeLists.txt
@@ -1,8 +1,6 @@
-cmake_minimum_required(VERSION 2.8.11)
+cmake_minimum_required(VERSION 3.1)
 project(test_package C)
 
-set(CMAKE_VERBOSE_MAKEFILE TRUE)
-
 include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
 conan_basic_setup()
 
diff --git a/recipes/jbig/all/test_package/test_package.c b/recipes/jbig/all/test_package/test_package.c
--- a/recipes/jbig/all/test_package/test_package.c
+++ b/recipes/jbig/all/test_package/test_package.c
@@ -10,4 +10,4 @@ int main() {
     jbg_dec_free(&state);
 
     return EXIT_SUCCESS;
-}
\ No newline at end of file
+}