Commit b51f46c9 authored by Ole Christian Eidheim's avatar Ole Christian Eidheim

Added cmake options LIBCLANG_PATH and LIBLLDB_PATH

parent 27f1ce6a
Pipeline #120163605 passed with stages
in 16 minutes
......@@ -40,11 +40,12 @@ if(${CMAKE_SYSTEM_NAME} MATCHES FreeBSD)
link_directories(/usr/local/lib)
endif()
option(BUILD_TESTING OFF)
option(BUILD_TESTING "Build tests")
option(LIBCLANG_PATH "Use custom path for libclang")
option(LIBLLDB_PATH "Use custom path for liblldb")
set(BUILD_TESTING_SAVED ${BUILD_TESTING})
set(BUILD_TESTING OFF CACHE BOOL "Disable sub-project tests" FORCE)
add_subdirectory(lib/libclangmm)
add_subdirectory(lib/tiny-process-library)
set(BUILD_TESTING ${BUILD_TESTING_SAVED} CACHE BOOL "Set to previous value" FORCE)
......@@ -54,10 +55,31 @@ include(FindPkgConfig)
pkg_check_modules(GTKMM gtkmm-3.0 REQUIRED)
pkg_check_modules(GTKSVMM gtksourceviewmm-3.0 REQUIRED)
pkg_check_modules(LIBGIT2 libgit2 REQUIRED)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/lib/libclangmm/cmake_modules/")
find_package(LibClang REQUIRED)
#Find liblldb with the same version as the version of libclang found
string(REPLACE libclang liblldb LIBLLDB_LIBRARIES "${LIBCLANG_LIBRARIES}")
include(FindPackageHandleStandardArgs)
if(LIBCLANG_PATH)
find_library(LIBCLANG_LIBRARIES clang "${LIBCLANG_PATH}/lib" NO_DEFAULT_PATH)
set(LIBCLANG_INCLUDE_DIRS "${LIBCLANG_PATH}/include")
if(LIBCLANG_LIBRARIES)
find_package_handle_standard_args(libclang DEFAULT_MSG LIBCLANG_LIBRARIES LIBCLANG_INCLUDE_DIRS)
else()
message(FATAL_ERROR "libclang not found")
endif()
else()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/lib/libclangmm/cmake_modules/")
find_package(LibClang REQUIRED)
endif()
add_subdirectory(lib/libclangmm/src)
if(LIBLLDB_PATH)
find_library(LIBLLDB_LIBRARIES lldb "${LIBLLDB_PATH}/lib" NO_DEFAULT_PATH)
set(LIBLLDB_INCLUDE_DIRS "${LIBLLDB_PATH}/include")
else()
# Find liblldb with the same version as the version of libclang found
string(REPLACE libclang liblldb LIBLLDB_LIBRARIES "${LIBCLANG_LIBRARIES}")
set(LIBLLDB_INCLUDE_DIRS ${LIBCLANG_INCLUDE_DIRS})
endif()
if(EXISTS "${LIBLLDB_LIBRARIES}")
set(LIBLLDB_FOUND TRUE)
elseif(EXISTS "${LIBLLDB_LIBRARIES}.1")
......@@ -66,6 +88,8 @@ elseif(EXISTS "${LIBLLDB_LIBRARIES}.1")
endif()
if(LIBLLDB_FOUND)
add_definitions(-DJUCI_ENABLE_DEBUG)
include_directories(${LIBLLDB_INCLUDE_DIRS})
find_package_handle_standard_args(liblldb DEFAULT_MSG LIBLLDB_LIBRARIES LIBLLDB_INCLUDE_DIRS)
else()
set(LIBLLDB_LIBRARIES "")
message("liblldb not found. Building juCi++ without debugging support")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment