I am sorry for being so naive. I tried to understand from this cmake website's link But could not understand. I have a sample cmake file, where an executable is generated by
add_executable(${PROJECT_NAME}_node src/filename.cpp)
Then later it installed by the following command
install(TARGETS ${PROJECT_NAME}_node ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} )
This cmake is from ROS so catkin is there. The overall question remains the same. Does someone know, why do we need to install TARGETS/ FILES?