ldc-developers/ldc — pull request #146 by redstar (2012-07-25 04:41:18+00:00)
Title: Simplify CMakeLists.txt.

Lot of code in CMakeLists.txt deals with configuration of LLVM.

This can really be simplified by initializing all targets and using LLVM 3.1 features:
* `llvm::sys::getDefaultTargetTriple()` returns the default target triple
* `llvm::Triple` provides parsing of triple strings
* methods `get64BitArchVariant()` and `get32BitArchVariant()` of `llvm::Triple` can be used to implement -m32 and -m64. This also works with other architectures, e.g. ppc/ppc64 and mips/mips64.

I think more simplifications are possible by using llvm::Triple as type for global.params.llvmArch and global.params.os (e.g. using Triple.isOSWindows())

This version works with LLVM 3.0 and 3.1. I added a compatibility layer for missing functions. The LLVM version is detected by CMake and passed to the compiler as a numeric value. Simple checks for specific versions are then possible.

If everybody thinks that this approach is the way to go then I would start to merge master and llvm-3.1 branch.