Browse Source

Added cmake options LIBCLANG_PATH and LIBLLDB_PATH

merge-requests/399/head
eidheim 6 years ago
parent
commit
b51f46c982
  1. 36
      CMakeLists.txt

36
CMakeLists.txt

@ -40,11 +40,12 @@ if(${CMAKE_SYSTEM_NAME} MATCHES FreeBSD)
link_directories(/usr/local/lib) link_directories(/usr/local/lib)
endif() 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_SAVED ${BUILD_TESTING})
set(BUILD_TESTING OFF CACHE BOOL "Disable sub-project tests" FORCE) set(BUILD_TESTING OFF CACHE BOOL "Disable sub-project tests" FORCE)
add_subdirectory(lib/libclangmm)
add_subdirectory(lib/tiny-process-library) add_subdirectory(lib/tiny-process-library)
set(BUILD_TESTING ${BUILD_TESTING_SAVED} CACHE BOOL "Set to previous value" FORCE) 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(GTKMM gtkmm-3.0 REQUIRED)
pkg_check_modules(GTKSVMM gtksourceviewmm-3.0 REQUIRED) pkg_check_modules(GTKSVMM gtksourceviewmm-3.0 REQUIRED)
pkg_check_modules(LIBGIT2 libgit2 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) include(FindPackageHandleStandardArgs)
#Find liblldb with the same version as the version of libclang found
string(REPLACE libclang liblldb LIBLLDB_LIBRARIES "${LIBCLANG_LIBRARIES}") 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}") if(EXISTS "${LIBLLDB_LIBRARIES}")
set(LIBLLDB_FOUND TRUE) set(LIBLLDB_FOUND TRUE)
elseif(EXISTS "${LIBLLDB_LIBRARIES}.1") elseif(EXISTS "${LIBLLDB_LIBRARIES}.1")
@ -66,6 +88,8 @@ elseif(EXISTS "${LIBLLDB_LIBRARIES}.1")
endif() endif()
if(LIBLLDB_FOUND) if(LIBLLDB_FOUND)
add_definitions(-DJUCI_ENABLE_DEBUG) add_definitions(-DJUCI_ENABLE_DEBUG)
include_directories(${LIBLLDB_INCLUDE_DIRS})
find_package_handle_standard_args(liblldb DEFAULT_MSG LIBLLDB_LIBRARIES LIBLLDB_INCLUDE_DIRS)
else() else()
set(LIBLLDB_LIBRARIES "") set(LIBLLDB_LIBRARIES "")
message("liblldb not found. Building juCi++ without debugging support") message("liblldb not found. Building juCi++ without debugging support")

Loading…
Cancel
Save