[CMake] LLVM_PROGRAM_PREFIX support

Hi,

I am planning to add support to CMake so that the binaries of llvm will have a prefix appended to it.

At this point, I am stuck on which approach to follow

  1. Append the prefix during build and install time. If so, this might involve tweaking lit infrastructure to make sure lit picks the prefixed binaries.

  2. Append the prefix only during install time.

a. Either create symbolic links with prefixed names to existing binaries. On windows this might create copies bloating the install directory

b. Or rename the existing binaries with prefixed name.

We may not need all the binaries to be prefixed . It doesn’t make sense to prefix the utils FileCheck, not, count, llvm-config etc.

I might add two CMake variables

LLVM_PROGRAM_PREFIX

LLVM_PROGRAM_PREFIX_EXCLUSION_LIST (This will specify the list of binaries that don’t need a prefix)

Let me know your thoughts

–Sumanth G

I’m not against the idea, but why do we need prefixes at all? I understand with GCC the need to prefix with the target triple as it uses separate programs for each target, but I think that is not the case with LLVM/CLang.

In any case, if prefixes are supported, why not universally apply to all rather than having special exemptions that are going to make generalised build configuration more difficult?

MartinO

This has been discussed in the past and there was some interest in this feature. Our use case is that we ship the Hexagon compiler that only has the Hexagon target in it. On top of that, it is a cross-compiler, so it runs on X86, but generates code for Hexagon. All relevant binaries in that installation are prefixed with hexagon-, so that clang is hexagon-clang, etc. This avoids any potential name conflicts with the host clang.

-Krzysztof

In any case, if prefixes are supported, why not universally apply to all rather than having special exemptions that are going to make generalised build configuration more difficult?

Agree. But, this is purely implementation specific.

In any case, if prefixes are supported, why not universally apply to all rather than having special exemptions that are going to make generalised build configuration more difficult?

Agree. But, this is purely implementation specific.