Use the TARGET clause of the if command:
conditionally_add (mylib mysrc.cc ${some_condition})
if (TARGET mylib)
# Do something when target found
endif()
Use the TARGET clause of the if command:
conditionally_add (mylib mysrc.cc ${some_condition})
if (TARGET mylib)
# Do something when target found
endif()