iti dattātreyayogaśāstre –
brāhmaṇaḥ śramaṇo’ vapy bauddho vāpy ārhato’thavā|kapāliko vā cārvākaḥ śraddhayā sahitaḥ sudhiḥ||yogābhyāsarato nityaṃ sarvasiddhimavāpnuyāt|
(Whether a Brahmin,an ascetic,a Jain or a Buddhist or a Kapālika or a Cārvāka materialist,the wise man who is endowed with faith and constantly devoted to the practice of yoga will obtain complete success)
“The statement that a brāhmaṇa, kapālika, bauddha and jaina can achieve success by yoga is to be understood thus. Surely, we cannot interpret kapālika, bauddhādi terms as referring to those who practice the tenets of that school in that entirety. For yoga emphasizes self-restraint and bhūtadayā in one’s acts and the kapālika, if he continues to practice the kapālika dharma fully, he will contravene these precepts of yoga and will not achieve success. Hence, it refers only to practices which are not in contradiction with the precepts of yoga and the dharma of the veda since the sūtrakāra of the yoga siddhānta (pātañjali) accepts veda as pramāṇa. Or, some understand that verse in this manner too, which is not really different from the previous meaning. The śramana and jaina; what they seek to achieve by torturing their bodies, the freedom from karma, they can achieve by practicing yoga. The kapālika, without resorting to any of the fierce acts prescribed for him, can attain union with rudra by practice of this yoga. The brāhmaṇa, unable to exhaust the repository of the vedas, by means of yoga with hiraṇyagarbha, attains the fruit of realizing the whole veda without doing all the karma in the Veda. This is what is meant by success. To each, his desired fruit is granted. In this way, there will be no contradiction. If it be argued that a kristu-panthin can practice yoga as he too wishes to attain Union with that deva, we reject it. A kristu-vādin cannot practice yoga as the devata he worships does not tolerate his pronouncing the names of other devas,let alone revering them. His mata is fundamentally a mata of dveṣa not kṛpā, let alone prema(even if it masquerades and sells itself as one such mata), as demonstrated by the vaiśya-cūḍāmaṇi and his beloved disciple, and the warnings of hypocrisy in the next verses apply to them in the context of our times most appropriately.The acceptance of pātañjali as ācārya, shraddhā in om(praṇava) as sacred sound, faith in the śruti and hiraṇyagarbha are all precluded for him. Hence, for him, there is no success in this path. If it be argued that the bauddha too rejects the veda, we reply that the bauddhas either have to accept that the Veda has limited application (they already do that to some extent in the Mañjuśrīmūlakalpa in their vulgar Sanskrit “eṣa mantro mahābrahmā bodhisattvena … ābhicārukeṣu sarveṣu athavo* ceda paṭhyate ।”),and the pāñcarātrins and śaivas do not reject the Veda but merely state that their own śāstras are viśeṣa, or they have to renounce bauddham and accept the veda wholeheartedly. Thus, this argument too is rejected. Our original interpretation stands. What we said for the kristu-panthin, the same for the mahāmāda-panthin.”
If it be the second alternative, it is to be understood that the terms, ‘brāhmaṇa, bauddha, kapālika, etc’ in the shloka merely point to the status of the person at the time he is about to take up yoga. In the cases of bauddhakapālikādi, there is a renunciation of their formerly held beliefs. The bauddha, if he previously rejected the pramāṇatvam of the veda or ascribed sinful motives to the Veda, stops doing that when he takes up yoga. The kapālika gives up the idea that union with rudra is achieved by doing censureable acts. Hence, the śloka, of the second alternative is adopted, would mean that all persons, regardless of what doctrine they previously followed, would attain success when they take up yoga and act in accordance with the rules therein.
(Slightly modified with credits to @Ghorangirasa.)