aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindJeMalloc.cmake48
-rw-r--r--cmake/GenerateHelptags.cmake8
2 files changed, 55 insertions, 1 deletions
diff --git a/cmake/FindJeMalloc.cmake b/cmake/FindJeMalloc.cmake
new file mode 100644
index 0000000000..fd20a456fb
--- /dev/null
+++ b/cmake/FindJeMalloc.cmake
@@ -0,0 +1,48 @@
+# - Try to find jemalloc
+# Once done this will define
+# JEMALLOC_FOUND - System has jemalloc
+# JEMALLOC_INCLUDE_DIRS - The jemalloc include directories
+# JEMALLOC_LIBRARIES - The libraries needed to use jemalloc
+
+find_package(PkgConfig)
+if(NOT JEMALLOC_USE_BUNDLED)
+ find_package(PkgConfig)
+ if (PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_JEMALLOC QUIET jemalloc)
+ endif()
+else()
+ set(PC_JEMALLOC_INCLUDEDIR)
+ set(PC_JEMALLOC_INCLUDE_DIRS)
+ set(PC_JEMALLOC_LIBDIR)
+ set(PC_JEMALLOC_LIBRARY_DIRS)
+ set(LIMIT_SEARCH NO_DEFAULT_PATH)
+endif()
+
+set(JEMALLOC_DEFINITIONS ${PC_JEMALLOC_CFLAGS_OTHER})
+
+find_path(JEMALLOC_INCLUDE_DIR jemalloc/jemalloc.h
+ PATHS ${PC_JEMALLOC_INCLUDEDIR} ${PC_JEMALLOC_INCLUDE_DIRS}
+ ${LIMIT_SEARCH})
+
+# If we're asked to use static linkage, add libjemalloc.a as a preferred library name.
+if(JEMALLOC_USE_STATIC)
+ list(APPEND JEMALLOC_NAMES
+ "${CMAKE_STATIC_LIBRARY_PREFIX}jemalloc${CMAKE_STATIC_LIBRARY_SUFFIX}")
+endif()
+
+list(APPEND JEMALLOC_NAMES jemalloc)
+
+find_library(JEMALLOC_LIBRARY NAMES ${JEMALLOC_NAMES}
+ HINTS ${PC_JEMALLOC_LIBDIR} ${PC_JEMALLOC_LIBRARY_DIRS}
+ ${LIMIT_SEARCH})
+
+set(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY})
+set(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE
+# if all listed variables are TRUE
+find_package_handle_standard_args(JeMalloc DEFAULT_MSG
+ JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR)
+
+mark_as_advanced(JEMALLOC_INCLUDE_DIR JEMALLOC_LIBRARY)
diff --git a/cmake/GenerateHelptags.cmake b/cmake/GenerateHelptags.cmake
index 658f4ab9cc..d4f4518b9b 100644
--- a/cmake/GenerateHelptags.cmake
+++ b/cmake/GenerateHelptags.cmake
@@ -9,6 +9,12 @@ else()
endif()
message(STATUS "Generating helptags in ${HELPTAGS_WORKING_DIRECTORY}.")
+if(EXISTS "${HELPTAGS_WORKING_DIRECTORY}/")
+ message(STATUS "${HELPTAGS_WORKING_DIRECTORY} already exists")
+ # if the doc directory already exists, helptags could fail due to duplicate
+ # tags. Tell the user to remove the directory and try again.
+ set(TROUBLESHOOTING "\nRemove \"${HELPTAGS_WORKING_DIRECTORY}\" and try again")
+endif()
execute_process(
COMMAND "${CMAKE_CURRENT_BINARY_DIR}/bin/nvim"
@@ -22,5 +28,5 @@ execute_process(
RESULT_VARIABLE res)
if(NOT res EQUAL 0)
- message(FATAL_ERROR "Generating helptags failed: ${err} - ${res}")
+ message(FATAL_ERROR "Generating helptags failed: ${err} - ${res}${TROUBLESHOOTING}")
endif()