Repository: conan-io/conan-center-index

Issue:
[package] proj/7.1.1: 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: **proj/7.1.1**
  * 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=armv8
arch_build=x86_64
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=11.0
os=iOS
os.version=11.0
os_build=Macos
[options]
*:build_executable=False
proj:with_curl=False
proj:with_tiff=False
[build_requires]
*: darwin-toolchain/1.0.8@theodelrieu/stable
[env]
```


### Steps to reproduce (Include if Applicable)

`conan install proj/7.1.0@ --profile ios11-arm64 -o '*:build_executable=False' -o 'proj:with_tiff=False' -o 'proj:with_curl=False' --build=missing`

### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
CMake Error at source_subfolder/src/bin_cct.cmake:14 (install):
  install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable
  target "cct".
Call Stack (most recent call first):
  source_subfolder/src/CMakeLists.txt:45 (include)


CMake Error at source_subfolder/src/bin_cs2cs.cmake:13 (install):
  install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable
  target "cs2cs".
Call Stack (most recent call first):
  source_subfolder/src/CMakeLists.txt:50 (include)


CMake Error at source_subfolder/src/bin_geod.cmake:15 (install):
  install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable
  target "geod".
Call Stack (most recent call first):
  source_subfolder/src/CMakeLists.txt:55 (include)


CMake Error at source_subfolder/src/bin_proj.cmake:16 (install):
  install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable
  target "binproj".
Call Stack (most recent call first):
  source_subfolder/src/CMakeLists.txt:63 (include)


CMake Error at source_subfolder/src/bin_projinfo.cmake:12 (install):
  install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable
  target "binprojinfo".
Call Stack (most recent call first):
  source_subfolder/src/CMakeLists.txt:68 (include)


CMake Error at source_subfolder/src/bin_gie.cmake:14 (install):
  install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable
  target "gie".
Call Stack (most recent call first):
  source_subfolder/src/CMakeLists.txt:73 (include)
```

</details>

I would suggest adding an option that disables all the executable targets from being generated and built, like `build_executables`. Alternatively, the recipe could define individual `build_` options for each executable, but I don't know how worthwhile that level of granularity is since these are not large applications. (I personally prefer the single `build_executables` option.)

For reference, `glslang` provides this `build_executables` option to enable/disable its binaries, while `sqlite3`, `bzip2`, and `spirv-cross` provide the similarly named `build_executable` option for their (single) binary executable.


Discussion:

Resolving patch:
diff --git a/recipes/proj/all/conanfile.py b/recipes/proj/all/conanfile.py
--- a/recipes/proj/all/conanfile.py
+++ b/recipes/proj/all/conanfile.py
@@ -19,14 +19,16 @@ class ProjConan(ConanFile):
         "fPIC": [True, False],
         "threadsafe": [True, False],
         "with_tiff": [True, False],
-        "with_curl": [True, False]
+        "with_curl": [True, False],
+        "build_executables": [True, False]
     }
     default_options = {
         "shared": False,
         "fPIC": True,
         "threadsafe": True,
         "with_tiff": True,
-        "with_curl": True
+        "with_curl": True,
+        "build_executables": True
     }
 
     _cmake = None
@@ -76,12 +78,12 @@ def _configure_cmake(self):
             return self._cmake
         self._cmake = CMake(self)
         self._cmake.definitions["USE_THREAD"] = self.options.threadsafe
-        self._cmake.definitions["BUILD_CCT"] = True
-        self._cmake.definitions["BUILD_CS2CS"] = True
-        self._cmake.definitions["BUILD_GEOD"] = True
-        self._cmake.definitions["BUILD_GIE"] = True
-        self._cmake.definitions["BUILD_PROJ"] = True
-        self._cmake.definitions["BUILD_PROJINFO"] = True
+        self._cmake.definitions["BUILD_CCT"] = self.options.build_executables
+        self._cmake.definitions["BUILD_CS2CS"] = self.options.build_executables
+        self._cmake.definitions["BUILD_GEOD"] = self.options.build_executables
+        self._cmake.definitions["BUILD_GIE"] = self.options.build_executables
+        self._cmake.definitions["BUILD_PROJ"] = self.options.build_executables
+        self._cmake.definitions["BUILD_PROJINFO"] = self.options.build_executables
         self._cmake.definitions["PROJ_DATA_SUBDIR"] = "res"
         if tools.Version(self.version) < "7.0.0":
             self._cmake.definitions["PROJ_TESTS"] = False
@@ -93,7 +95,7 @@ def _configure_cmake(self):
             self._cmake.definitions["ENABLE_CURL"] = self.options.with_curl
             self._cmake.definitions["BUILD_TESTING"] = False
             self._cmake.definitions["ENABLE_IPO"] = False
-            self._cmake.definitions["BUILD_PROJSYNC"] = self.options.with_curl
+            self._cmake.definitions["BUILD_PROJSYNC"] = self.options.build_executables and self.options.with_curl
         self._cmake.configure()
         return self._cmake
 
@@ -137,6 +139,7 @@ def package_info(self):
         res_path = os.path.join(self.package_folder, "res")
         self.output.info("Appending PROJ_LIB environment variable: {}".format(res_path))
         self.env_info.PROJ_LIB.append(res_path)
-        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)
+        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: