Selaa lähdekoodia

bison/flex requirement softened

Nicolas Winkler 6 vuotta sitten
vanhempi
commit
58e8e7a48e
1 muutettua tiedostoa jossa 11 lisäystä ja 6 poistoa
  1. 11 6
      src/CMakeLists.txt

+ 11 - 6
src/CMakeLists.txt

@@ -13,23 +13,28 @@ set(CMAKE_CXX_EXTENSIONS OFF)
 
 
 
-find_package(BISON 3.0.0 REQUIRED)
-find_package(FLEX 2.4.0 REQUIRED)
+find_package(BISON 3.0.0)
+find_package(FLEX 2.4.0)
 find_package(LLVM REQUIRED CONFIG)
 
 if( NOT LLVM_FOUND )
   message(FATAL_ERROR "LLVM package can't be found. Set CMAKE_PREFIX_PATH variable to LLVM's installation prefix.")
 endif()
 
-BISON_TARGET(QlowParser ast/syntax.y ${CMAKE_CURRENT_BINARY_DIR}/syntax.cpp)
-FLEX_TARGET(QlowLexer ast/lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp)
-ADD_FLEX_BISON_DEPENDENCY(QlowLexer QlowParser)
+if ( BISON_FOUND AND FLEX_FOUND )
+    BISON_TARGET(QlowParser ast/syntax.y ${CMAKE_CURRENT_BINARY_DIR}/syntax.cpp)
+    FLEX_TARGET(QlowLexer ast/lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp)
+    ADD_FLEX_BISON_DEPENDENCY(QlowLexer QlowParser)
+else()
+    FILE(GLOB AdditionalSources bison/*.cpp)
+    include_directories(bison/)
+endif()
 
 FILE(GLOB CppSources *.cpp ast/*.cpp sem/*.cpp)
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
 include_directories(ast sem .)
 
-add_executable(${PROJECT_NAME} ${BISON_QlowParser_OUTPUTS} ${FLEX_QlowLexer_OUTPUTS} ${CppSources})
+add_executable(${PROJECT_NAME} ${BISON_QlowParser_OUTPUTS} ${FLEX_QlowLexer_OUTPUTS} ${CppSources} ${AdditionalSources})
 
 
 include_directories( ${LLVM_INCLUDE_DIRS} )