Skip to content

Instantly share code, notes, and snippets.

@fntlnz

fntlnz/CMakeLists.txt

Forked from scan/CMakeLists.txt
Last active Aug 29, 2015
Embed
What would you like to do?
cmake_minimum_required(VERSION 2.8)
find_package(BISON)
find_package(FLEX)
add_definitions(-D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS)
BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp)
FLEX_TARGET(MyScanner tokens.l ${CMAKE_CURRENT_BINARY_DIR}/tokens.cpp)
ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(toyc ${BISON_MyParser_OUTPUTS} ${FLEX_MyScanner_OUTPUTS} codegen.cpp main.cpp)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/usr/local/share/llvm/cmake")
find_package(LLVM)
if( NOT LLVM_FOUND )
message(FATAL_ERROR "LLVM package can't be found. Set CMAKE_PREFIX_PATH variable to LLVM's installation prefix.")
endif()
include_directories( ${LLVM_INCLUDE_DIRS} )
link_directories( ${LLVM_LIBRARY_DIRS} )
llvm_map_components_to_libraries(REQ_LLVM_LIBRARIES jit native)
target_link_libraries(toyc ${REQ_LLVM_LIBRARIES})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment