I am using cmake as build generator. version : 3.18.5 I have 5 targets in my project. I want to compile only particular set of targets depends upon the option i give during make. How to do this?
for example, if i run
gmake -j4 foo=set2
I want target app1,app3,app5 should get compiled. if i run
gmake -j4 foo=3
i want target app2,app4 should get compiled.
i tried the above things and inside cmakelist.txt,
if(foo STREQUAL "set2")
add_subdirectory(../../app1)
add_subdirectory(../../app3)
add_subdirectory(../../app5)
elseif(foo STREQUAL "set3")
add_subdirectory(../../app2)
add_subdirectory(../../app4)
endif()
But i did not got the expected result.