|
1 | | -cmake_minimum_required (VERSION 2.8.4) |
| 1 | +cmake_minimum_required (VERSION 2.8.8) |
2 | 2 |
|
3 | 3 | set(project_name juci) |
4 | 4 | project (${project_name}) |
5 | 5 |
|
| 6 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread -Wall -Wextra -Wno-unused-parameter -Wno-reorder") |
| 7 | +if(CMAKE_BUILD_TYPE STREQUAL "") |
| 8 | + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") |
| 9 | +endif() |
| 10 | + |
| 11 | +if(APPLE) |
| 12 | + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -undefined dynamic_lookup") #TODO: fix this |
| 13 | + link_directories(/usr/local/lib /usr/local/opt/gettext/lib) |
| 14 | + include_directories(/usr/local/opt/gettext/include) |
| 15 | + set(CMAKE_MACOSX_RPATH 1) |
| 16 | + set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig") |
| 17 | +endif() |
| 18 | + |
| 19 | +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules/") |
| 20 | +find_package(LibClang REQUIRED) |
| 21 | + |
| 22 | +#Find liblldb with the same version as the version of libclang found |
| 23 | +string(REPLACE libclang liblldb LIBLLDB_LIBRARIES "${LIBCLANG_LIBRARIES}") |
| 24 | +if(EXISTS "${LIBLLDB_LIBRARIES}") |
| 25 | + set(LIBLLDB_FOUND TRUE) |
| 26 | +elseif(EXISTS "${LIBLLDB_LIBRARIES}.1") |
| 27 | + set(LIBLLDB_LIBRARIES "${LIBLLDB_LIBRARIES}.1") |
| 28 | + set(LIBLLDB_FOUND TRUE) |
| 29 | +endif() |
| 30 | +if(LIBLLDB_FOUND) |
| 31 | + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DJUCI_ENABLE_DEBUG") |
| 32 | +else() |
| 33 | + set(LIBLLDB_LIBRARIES "") |
| 34 | + message("liblldb not found. Building juCi++ without debugging support") |
| 35 | +endif() |
| 36 | + |
| 37 | +find_package(Boost 1.54 COMPONENTS regex system filesystem REQUIRED) |
| 38 | +find_package(ASPELL REQUIRED) |
| 39 | +include(FindPkgConfig) |
| 40 | +pkg_check_modules(GTKMM gtkmm-3.0 REQUIRED) |
| 41 | +pkg_check_modules(GTKSVMM gtksourceviewmm-3.0 REQUIRED) |
| 42 | + |
6 | 43 | add_subdirectory("src") |
7 | 44 |
|
| 45 | +#TODO: instead of the if-expression below, disable tests on Travis CI for clang++ builds |
| 46 | +if(NOT (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND (NOT $ENV{distribution} STREQUAL ""))) |
| 47 | + if(ENABLE_TESTING) |
| 48 | + enable_testing() |
| 49 | + add_subdirectory(tests) |
| 50 | + endif() |
| 51 | +endif() |
| 52 | + |
8 | 53 | if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") |
9 | 54 | install(FILES "${CMAKE_SOURCE_DIR}/share/juci.desktop" |
10 | 55 | DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications") |
|
0 commit comments