Skip to content

Instantly share code, notes, and snippets.

@riywo
Last active April 24, 2018 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riywo/d90d5c9682f5c253ea86813ff134933b to your computer and use it in GitHub Desktop.
Save riywo/d90d5c9682f5c253ea86813ff134933b to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 3.10)
project(myproject)
set(CMAKE_CXX_STANDARD 14)
find_package(LLVM REQUIRED CONFIG)
include_directories(${LLVM_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})
add_executable(frontend frontend.cpp)
llvm_map_components_to_libnames(llvm_libs core)
target_link_libraries(frontend ${llvm_libs})
add_custom_command(OUTPUT foo.ll foo.o
COMMAND $<TARGET_FILE:frontend> > foo.ll
COMMAND ${LLVM_TOOLS_BINARY_DIR}/llc -filetype=obj -o foo.o foo.ll)
add_executable(foo foo.o)
target_link_libraries(foo ${llvm_libs}) # TODO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment