If you check here,
https://docs.espressif.com/projects/esp ... ystem.html
under renaming main component, it gives you instructions if you are not using main.c or main directory.
In my case I am using src directory with main.cpp as the file with my 'main code'
Adding src to the root project Cmakelists file with the below helped.
set(EXTRA_COMPONENT_DIRS src ../commoncomponents )
Also running idf.py reconfigure task (you can find this in VIEW..COMMAND PALETTE) usually helps when you have changes Cmale needs to know about.
if you are coding in CPP, you need to use
extern "C" void app_main(void)
instead of the app_main() for if you are using C