When you change departments, even within a university, your research progress towards tenure needs to be negotiated as part of your offer. Even within similar fields (say, computer engineering and computer science), standards vary widely. Some comp. engineering departments place a lot of stock on journal publications (I turned down such an offer because I was explicitly told I'd need to produce IEEE journal publications to get tenure, so leaving my current research community), whereas CS departments generally recognize conferences as valid venues for publications.
Whether your progress in a different department will be recognized in effectively another field strongly depends on
a. how much intersection is there between your work in the current department and your prospective future move.
b. how willing will a future department be to accept your progress in a different field. Some CS departments are more interdisciplinary than others, and this decision could depend on who the current head/dean is, your own attractiveness as a hire, and a variety of other factors.
I would say that from my (obviously anecdotal) experience, cross-disciplinary jumps are not sufficiently incentivized since the research products of disciplines are not necessarily recognized by others. However, I've also seen success stories, especially in cases where the researcher has maintained ties with the prospective discipline. So - if you feel like you may switch to CS later in your career, then you should definitely maintain professional ties (in the form of co-supervising CS students, maintaining a publication record in relevant venues, applying for grants etc.) with a CS community.