# swegym / conan-io__conan-12762

- taskset: [swegym](https://harnessreport.com/tasks/swegym.md)
- difficulty: hard
- category: debugging
- language: 
- runnable from the site: no
- agent timeout: 3000s

## Results by harness

_none yet_

## Instruction

```
[feature] Allow specifying an install component for the CMake helper
One is capable of passing `--component` to CMake's `--install` command, however the same functionality is missing from the CMake helper's `install()` method: https://docs.conan.io/en/latest/reference/build_helpers/cmake.html#install

Since Conan does not package CMake configs generated by recipes, in many cases the recipe can just define the runtime component and there won't be a need to `rmdir` additional files.

I suggest adding a `component=None` argument to this method and restructuring it in terms of the cmake generated `cmake_install.cmake` script. The code would look something like this:

```py
def install(... component=None):
    if component is not None:
        if isinstance(component, str):
            component_args = [f"-DCOMPONENT={component}"]
        else:
            component_args = [f"-DCOMPONENT={c}" for c in component]
    else:
        component_args = [""]
    for comp in component_args:
        self.run(f"cmake -DBUILD_TYPE={build_type} {comp} -P cmake_install.cmake", cwd=bindir)
```

or maybe a new method like `install_component()` with a required positional argument, if such a break for v2 is not desirable.  
`find -name conanfile.py -exec grep -nHEe '\.install\([^)]' {} \;` shows no usage for this method being used with any arguments in CCI though.

- [x] I've read the [CONTRIBUTING guide](https://github.com/conan-io/conan/blob/develop/.github/CONTRIBUTING.md).
```
---
Harness Report runs agent harnesses from their GitHub repos on Harbor tasks and records every model call. Every page is also `.md` and `.json`; index: https://harnessreport.com/llms.txt · MCP: https://harnessreport.com/mcp
