# cmake install component is installing entire cmakelist.txt

**URL:** https://discourse.cmake.org/t/cmake-install-component-is-installing-entire-cmakelist-txt/14422
**Category:** Usage
**Tags:** os:windows
**Created:** [July 23, 2025, 5:46am UTC](https://discourse.cmake.org/t/cmake-install-component-is-installing-entire-cmakelist-txt/14422 "2025-07-23T05:46:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![akshatjain-tally](https://discourse.cmake.org/user_avatar/discourse.cmake.org/akshatjain-tally/32/5669_2.png) [@akshatjain-tally](https://discourse.cmake.org/u/akshatjain-tally)
#### Post date: [July 23, 2025, 5:46am UTC](https://discourse.cmake.org/t/cmake-install-component-is-installing-entire-cmakelist-txt/14422/1 "2025-07-23T05:46:00Z")

</div>

So, we have a CMakeList.txt which have around 74 projects in it, And for one project we use install component to install that library, but when ran the custom\_target to run the command:  
TW\_ADD\_CUSTOM\_TARGET(install\_${pTargetName}  
COMMAND ${CMAKE\_COMMAND} --install ${CMAKE\_BINARY\_DIR} --component ${pTargetName}  
COMMENT “Installing ${pTargetName} only”  
)

but when ran this custom command, it builds entire cmakelists.txt and then it installs the desired target.

So the question is:

1. Is this the correct way of using this install component?
2. And if yes, then tell where are we missing something?

Regards,  
Akshat Jain
