Add LLVM to project using cmake

匿名 (未验证) 提交于 2019-12-03 01:01:02

问题:

I'm trying to add LLVM to a cmake project, using cygwin as a compiler. I downloaded LLVM from cygwin's installer (just installed all of the llvm related packages). The files are there, however I cannot include LLVM in my project. I tried using the official guide for 3.5.2 (the version it installed) and my CMakeLists.txt looks like

cmake_minimum_required(VERSION 3.2) project(Lang)  find_package(LLVM REQUIRED CONFIG)  message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")   include_directories(${LLVM_INCLUDE_DIRS}) add_definitions(${LLVM_DEFINITIONS}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")  set(SOURCE_FILES main.cpp)  add_executable(Lang ${SOURCE_FILES})  llvm_map_components_to_libnames(llvm_libs support core irreader)  # Link against LLVM libraries target_link_libraries(Lang ${llvm_libs})

However, I get a bunch of errors like these

Am I doing something wrong? All I want to do is to use LLVM in my project.

回答1:

As indicated by Marco A. in the comments, the problem were missing libraries. This link helped resolve the issue, and everything seems to be working normally now. https://stackoverflow.com/a/25783251/1938163

Thank you.



转载请标明出处:Add LLVM to project using cmake
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!