This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] [CMake] Don't use llvm_replace_compiler_option
ClosedPublic

Authored by mstorsjo on Feb 28 2019, 2:46 AM.

Details

Summary

Building compiler-rt standalone outside of the main llvm tree is supported. In this case, the llvm cmake modules can be unavailable. (They're generally not needed for plain building the libraries, but are necessary for things like the testsuite. Even if the cmake modules are available, this function is provided by LLVMProcessSources.cmake, which currently isn't being included.)

This fixes building compiler-rt standalone with MSVC/clang-cl, where this cmake command isn't available.

Diff Detail

Event Timeline

mstorsjo created this revision.Feb 28 2019, 2:46 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 28 2019, 2:46 AM
Herald added subscribers: Restricted Project, jdoerfert, mgorny, dberris. · View Herald Transcript
rnk added a comment.Feb 28 2019, 9:17 AM

I'd prefer to keep the same /Zi vs. /Z7 setting in the standalone build. Does the standalone build not have access to the installed LLVM cmake modules? If so, I would think we could include them. Or, we could put in a basic regex here like we used to have for -DNDEBUG.

In D58767#1413871, @rnk wrote:

I'd prefer to keep the same /Zi vs. /Z7 setting in the standalone build. Does the standalone build not have access to the installed LLVM cmake modules?

It can be built both with and without the LLVM cmake modules. In this particular case, the cmake modules should have been available though.

If so, I would think we could include them. Or, we could put in a basic regex here like we used to have for -DNDEBUG.

Ok, I'll see if I can find how that was done.

mstorsjo updated this revision to Diff 188858.Mar 1 2019, 1:12 AM
mstorsjo retitled this revision from [compiler-rt] [CMake] Check for llvm_replace_compiler_option before using it to [compiler-rt] [CMake] Don't use llvm_replace_compiler_option.
mstorsjo edited the summary of this revision. (Show Details)

Changed to do the same thing with a regex.

rnk accepted this revision.Mar 1 2019, 11:44 AM

lgtm

CMakeLists.txt
382

I think the indentation here should be two spaces less

This revision is now accepted and ready to land.Mar 1 2019, 11:44 AM
This revision was automatically updated to reflect the committed changes.