Disable Fetch Content lib and header file Installation

Hello,

I use FetchContent and can build and link the libraries I need. When I install my project, I would like to skip or control library installations.

For the following example, what is the right way to skip library and header installation of the fmt?

# 
include(FetchContent)

FetchContent_Declare(fmt ...)
FetchContent_MakeAvailable(fmt)

Note: I use all the FetchContent usage in a third_party.cmake file, which I include in the main CMake file.

Thanks

UPDATE:

Adding EXCLUDE_FROM_ALL at the end of FetchContent_Declare() worked. I no longer see headers and libs. For shared libs, I control what to install by using install().

Please provide feedback if there is a better way to handle this.

Thanks