This is an archive of the discontinued LLVM Phabricator instance.

Always generate cmake config files
ClosedPublic

Authored by hintonda on Oct 5 2015, 4:23 PM.

Details

Reviewers
beanz
chapuni
Summary

Always generate and install cmake config files.

Currently, cmake config files are only generated and installed when CLANG_BUILD_STANDALONE set, which means config file will not be generated or installed when clang is built with llvm. This change removes that restriction.

Diff Detail

Event Timeline

hintonda updated this revision to Diff 36569.Oct 5 2015, 4:23 PM
hintonda retitled this revision from to Always generate cmake config files.
hintonda updated this object.
hintonda added a reviewer: chapuni.
hintonda added a subscriber: cfe-commits.

LGTM, but I haven't tested. I'll wait for 3rd opinion for several hours. :)

I thought it may be moved to an arbitrary subdirectory.

jordan_rose resigned from this revision.Oct 7 2015, 4:31 PM
jordan_rose edited reviewers, added: beanz; removed: jordan_rose.

I just get things to build with CMake, and I'm not involved with Clang so much these days. This is more about controlling what gets installed, which should be covered by someone else. ChrisB is spearheading the effort to ditch autoconf, so adding him instead.

beanz accepted this revision.Oct 7 2015, 4:36 PM
beanz edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Oct 7 2015, 4:36 PM

I am testing this with cmake-2.8.12. I remember some issues would be there.

chapuni requested changes to this revision.Oct 7 2015, 5:20 PM
chapuni edited edge metadata.

This change requires cmake-3.

With CMake-2.8.12.2,

CMake Error at /home/tnakamura/fio/ninja/llvm-project/clang/CMakeLists.txt:560 (export):
  export called with target "clangBasic" which requires target "LLVMCore"
  that is not in the export list.

  If the required target is not easy to reference in this call, consider
  using the APPEND option with multiple separate calls.

https://cmake.org/cmake/help/v3.0/release/3.0.0.html#commands

The export() command learned to work with multiple dependent export sets, thus allowing multiple packages to be built and exported from a single tree. The feature requires CMake to wait until the generation step to write the output file. This means one should not include() the generated targets file later during project configuration because it will not be available. Use Alias Targets instead. See policy CMP0024.

This revision now requires changes to proceed.Oct 7 2015, 5:20 PM
chapuni added a subscriber: rnk.Oct 7 2015, 5:22 PM

Installed cmake 2.8.12 and was able to reproduce error.

I'll look into it, but I'm tempted to only support newer versions of cmake, and let older versions maintain current behavior.

rnk added a comment.Oct 8 2015, 10:38 AM

I added this conditional check in r221415, with this message:

cmake: Only export targets in the standalone build

Trying to fix bots that didn't like the fact that I exported targets
that depended on LLVM without exporting targets from LLVM.

I assume this has already been addressed in LLVM? We now export targets there so we can depend on them in clang's exported targets file? If so, I'm happy to make this check simply conditional on the CMake version like you suggest.

I'm not actually a good reviewer for these kinds of things, I know very little about cmake package exports. =/ When I made this code change, I was just trying to hack the standalone build into shape. I haven't really used it since.

hintonda updated this revision to Diff 36889.EditedOct 8 2015, 12:19 PM
hintonda edited edge metadata.
  • add back check for standalone and add cmake version

Verified that cmake 3.0.2 works, so I made the check for anything greater than 3.

chapuni accepted this revision.Oct 8 2015, 4:28 PM
chapuni edited edge metadata.
chapuni added inline comments.
CMakeLists.txt
553–554

I'm afraid you mistook "conditionally skipped" as "worked".

Please change the condition, like

  • 2.9
  • 3.0.1 (Not sure any distros might take <3.0.2)
  • EQUAL 3 OR GREATER 3
  • NOT LESS 3
This revision is now accepted and ready to land.Oct 8 2015, 4:28 PM
hintonda updated this revision to Diff 36916.Oct 8 2015, 6:53 PM
hintonda edited edge metadata.

Add support for cmake version 3, i.e., 3.0.0...

Btw, I don't have commit access, so if you are happy with this change, could you commit it for me?

chapuni closed this revision.Oct 9 2015, 7:43 PM

Applied in r249935, thanks!