This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Fixes for including LLVM into another CMake project
Needs ReviewPublic

Authored by russell.gallop on Jan 21 2020, 10:15 AM.

Details

Summary

This fixes a couple of paths to allow add_subdirectory(llvm) from a higher level CMake project. Otherwise should be NFC.

Tested by creating a top level CMakeLists.txt in llvm-project:

cmake_minimum_required(VERSION 3.4.3)

project(my-super-project)

add_subdirectory(llvm)

And pointing cmake at that instead of llvm/CMakeLists.txt.

In this arrangement, most things are built inside an llvm directory inside the build directory. Some tools and files aren't which causes some test fails. This makes things consistent by changing CMAKE_BINARY_DIR to LLVM_BINARY_DIR and CMAKE_SOURCE_DIR to LLVM_SOURCE_DIR.

Diff Detail

Event Timeline

Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJan 21 2020, 10:15 AM
ormris added a subscriber: ormris.Jan 23 2020, 4:44 PM