Rework dependencies about custom target to be more CMake compliant