Special action for special source files

I will try to explain my problem abstractly:

I have a huge project, that compiles a lot of cpp files. Some of them do need special treatment after the build.
(My case: the need to be installed to a special folder and doxygen generation over these files)
They can be distinguished by individual properties
(My case: special folder name)

How do i do this?

I am thinking of a hook in add_library (etc.), that run (pseudo code):

foreach(SOURCE in SOURCES)

I guess i have to do the Hook myself by overloading add_library(). Am I correct? is there another way to do this? Maybe:

   SOURCES = get_properties(TARGET SOURCES)
   foreach(SOURCE in SOURCES)

(Using this CMake List of all Project Targets - #5 by developer)

Or is this like bad practice and I should do:


for each and every target?

You can either have a doxygen_wrap_sources(target) call or do tracking via some myproj_add_library that does things at that time. Which is better depends on the circumstances. Personally, I would think doxygen_wrap_sources works better here especially now that sources can be added after a target is declared (using target_sources).