set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
-
find_package(Qt5Widgets)
find_package(Qt5 CONFIG REQUIRED Widgets Gui)
find_package(QuaZip REQUIRED)
+find_package(LLVM REQUIRED)
find_package(PkgConfig)
pkg_check_modules(LOG4CXX REQUIRED liblog4cxx)
pkg_check_modules(GUILE REQUIRED guile-2.0)
add_definitions(${LOG4CXX_CFLAGS})
add_definitions(${GUILE_CFLAGS})
-find_program(LLVM_CONFIG llvm-config-3.5)
-
-if(NOT LLVM_CONFIG)
- message(FATAL_ERROR "LLVM not found")
-endif()
-
-execute_process(COMMAND ${LLVM_CONFIG} --cxxflags OUTPUT_VARIABLE LLVM_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
-execute_process(COMMAND ${LLVM_CONFIG} --ldflags OUTPUT_VARIABLE LLVM_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
-execute_process(COMMAND ${LLVM_CONFIG} --libs OUTPUT_VARIABLE LLVM_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
-execute_process(COMMAND ${LLVM_CONFIG} --system-libs OUTPUT_VARIABLE LLVM_SYSTEM_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-string(REPLACE -O2 "" LLVM_CFLAGS ${LLVM_CFLAGS})
-string(REPLACE -fno-exceptions "" LLVM_CFLAGS ${LLVM_CFLAGS})
-string(REPLACE -fno-rtti "" LLVM_CFLAGS ${LLVM_CFLAGS})
-string(REPLACE -DNDEBUG "" LLVM_CFLAGS ${LLVM_CFLAGS})
-string(REPLACE -I "-isystem" LLVM_CFLAGS ${LLVM_CFLAGS})
-
-separate_arguments(LLVM_CFLAGS)
add_definitions(${LLVM_CFLAGS})
add_definitions(-std=c++11 -Wall -Wextra)
add_definitions(-DQT_NO_KEYWORDS)
--- /dev/null
+find_program(LLVM_CONFIG NAMES llvm-config-3.5 llvm-config)
+
+if(LLVM_CONFIG)
+ execute_process(COMMAND ${LLVM_CONFIG} --version
+ OUTPUT_VARIABLE LLVM_VERSION)
+
+ if(((${LLVM_VERSION} VERSION_LESS 3.6.0)
+ AND (${LLVM_VERSION} VERSION_GREATER 3.5))
+ OR (${LLVM_VERSION} VERSION_EQUAL 3.5))
+
+ execute_process(COMMAND ${LLVM_CONFIG} --cxxflags
+ OUTPUT_VARIABLE LLVM_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${LLVM_CONFIG} --ldflags
+ OUTPUT_VARIABLE LLVM_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${LLVM_CONFIG} --libs
+ OUTPUT_VARIABLE LLVM_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${LLVM_CONFIG} --system-libs
+ OUTPUT_VARIABLE LLVM_SYSTEM_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ string(REPLACE -O2 "" LLVM_CFLAGS ${LLVM_CFLAGS})
+ string(REPLACE -fno-exceptions "" LLVM_CFLAGS ${LLVM_CFLAGS})
+ string(REPLACE -fno-rtti "" LLVM_CFLAGS ${LLVM_CFLAGS})
+ string(REPLACE -DNDEBUG "" LLVM_CFLAGS ${LLVM_CFLAGS})
+ string(REPLACE -I "-isystem" LLVM_CFLAGS ${LLVM_CFLAGS})
+
+ separate_arguments(LLVM_CFLAGS)
+ endif()
+endif()
+
+if(NOT DEFINED LLVM_CFLAGS)
+ message(SEND_ERROR "LLVM 3.5 required but not found")
+endif()
\ No newline at end of file