[LLVMdev] Fixing LLVM's CMake interface before LLVM3.5 release

Dan Liew dan at su-root.co.uk
Sun Jul 20 03:22:17 PDT 2014


On 18 July 2014 14:38, Brad King <brad.king at kitware.com> wrote:
> On 07/18/2014 08:51 AM, Dan Liew wrote:
>> * run.sh is supposed to have executable permissions. Previously the
>> ``configure_file`` command just copied the permissions on
>> ``run.sh.in``. The ``file(GENERATE ...)`` command does not do this. Is
>> there a way to fix this?
>
> The file(GENERATE) command needs to be taught options to set permissions.
> I've made a note for that.

Ok thanks.

> For now can't you just run the script through a shell:
>
>  /usr/bin/env bash /path/to/run.sh $args

I could. The small project I have is just a small tutorial though so I
prefer ease of use for anyone using it. So for now I'll just use
``cmake_policy(SET CMP0026 OLD)``, even though as you say it is the
wrong thing to do.


>> * The clang target is not being exported (I built clang in the usually
>> way by placing its source inside /path/to/llvm/source/tools/clang)
>
> Actually I don't think any Clang targets are exported yet.  That
> may or may not belong as a separate find_package(Clang).  Not sure.

I believe Clang has quite a few libraries of its own that are useful
so I think there should be a separate find_package(Clang).

> One could export a LLVM_TOOLS_DIR value from both the build and
> install trees to resolve this case the old fashioned way.

If I find time I'll write a patch to add this. Even though a client
can read the directory from one of the exported targets they might not
be aware they could do this so providing a LLVM_TOOLS_DIR variable
could be useful.

Would you mind if I implemented this by having code in
LLVMConfig.cmake that actually reads the $<TARGET_FILE_DIR:opt>
variable to set LLVM_TOOLS_DIR? I can guard this with a check for the
existence of the target so that if LLVM_BUILD_TOOLS is disabled an
error isn't produced.

>> Also should we also expose whether or not LLVM was built with
>> assertions? It's exposed as LLVM_BUILD_ENABLE_ASSERTIONS in the build
>> directory but isn't available in the installed version of LLVM.
>
> We already have a few LLVM_ENABLE_<SOMETHING> values exported.
> One could add LLVM_ENABLE_ASSERTIONS.

Okay. I've written a patch [1] for this. Please take a look when you the time.



[1] http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140714/226548.html

Thanks,
Dan.



More information about the llvm-dev mailing list