aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Szakmeister <john@szakmeister.net>2014-11-09 08:31:33 -0500
committerJohn Szakmeister <john@szakmeister.net>2014-11-09 08:31:33 -0500
commitdcccc1a50de3caea62ab12f9e15fc6f3e242b5c4 (patch)
tree54cb86c36c23f800cdf2d6a00a66fbd5fe14114d
parentc744bb8144b5dd14c014817b9250aa5325d53cfe (diff)
parent9344a40e741557948215dfeb4ae32b7c0d6d7b6b (diff)
downloadrneovim-dcccc1a50de3caea62ab12f9e15fc6f3e242b5c4.tar.gz
rneovim-dcccc1a50de3caea62ab12f9e15fc6f3e242b5c4.tar.bz2
rneovim-dcccc1a50de3caea62ab12f9e15fc6f3e242b5c4.zip
Merge pull request #1437 from jszakmeister/build-search-fixes
A few fixes for some build-related issues.
-rw-r--r--CMakeLists.txt38
-rw-r--r--cmake/FindIconv.cmake18
-rw-r--r--config/CMakeLists.txt7
-rw-r--r--src/nvim/CMakeLists.txt4
4 files changed, 48 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f413599adb..b74785cc2b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,26 @@ set(DEPS_BIN_DIR "${DEPS_INSTALL_DIR}/bin")
list(APPEND CMAKE_PREFIX_PATH ${DEPS_INSTALL_DIR})
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ # CMake tries to treat /sw and /opt/local as extension of the system path, but
+ # that doesn't really work out very well. Once you have a dependency that
+ # resides there and have to add it as an include directory, then any other
+ # dependency that could be satisfied from there must be--otherwise you can end
+ # up with conflicting versions. So, let's make them more of a priority having
+ # them be included as one of the first places to look for dependencies.
+ list(APPEND CMAKE_PREFIX_PATH /sw /opt/local)
+
+ # Work around some old, broken detection by CMake for knowing when to use the
+ # isystem flag. Apple's compilers have supported this for quite some time
+ # now.
+ if(CMAKE_COMPILER_IS_GNUCC)
+ set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
+ endif()
+ if(CMAKE_COMPILER_IS_GNUCXX)
+ set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
+ endif()
+endif()
+
# Version tokens
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC NVIM_VERSION_COMMIT)
@@ -31,17 +51,6 @@ endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
-# Work around some old, broken detection by CMake for knowing when to use the
-# isystem flag. Apple's compilers have supported this for quite some time now.
-if(APPLE)
- if(CMAKE_COMPILER_IS_GNUCC)
- set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
- endif()
- if(CMAKE_COMPILER_IS_GNUCXX)
- set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
- endif()
-endif()
-
# Default to -O2 on release builds.
string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
@@ -135,7 +144,12 @@ include_directories(SYSTEM ${LUAJIT_INCLUDE_DIRS})
find_package(LibIntl)
if(LibIntl_FOUND)
- include_directories(SYSTEM ${LibIntl_INCLUDE_DIR})
+ include_directories(SYSTEM ${LibIntl_INCLUDE_DIRS})
+endif()
+
+find_package(Iconv)
+if(Iconv_FOUND)
+ include_directories(SYSTEM ${Iconv_INCLUDE_DIRS})
endif()
# Determine platform's threading library. Set CMAKE_THREAD_PREFER_PTHREAD
diff --git a/cmake/FindIconv.cmake b/cmake/FindIconv.cmake
new file mode 100644
index 0000000000..f3a54e9d6f
--- /dev/null
+++ b/cmake/FindIconv.cmake
@@ -0,0 +1,18 @@
+# - Try to find iconv
+# Once done, this will define
+#
+# Iconv_FOUND - system has iconv
+# Iconv_INCLUDE_DIRS - the iconv include directories
+# Iconv_LIBRARIES - link these to use iconv
+
+include(LibFindMacros)
+
+find_path(ICONV_INCLUDE_DIR NAMES iconv.h)
+find_library(ICONV_LIBRARY NAMES iconv)
+
+set(Iconv_PROCESS_INCLUDES ICONV_INCLUDE_DIR)
+if(ICONV_LIBRARY)
+ set(Iconv_PROCESS_LIBS ICONV_LIBRARY)
+endif()
+
+libfind_process(Iconv)
diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt
index c48887548d..0f5dd7d984 100644
--- a/config/CMakeLists.txt
+++ b/config/CMakeLists.txt
@@ -44,12 +44,9 @@ check_function_exists(getpwent HAVE_GETPWENT)
check_function_exists(getpwnam HAVE_GETPWNAM)
check_function_exists(getpwuid HAVE_GETPWUID)
-check_include_files(iconv.h HAVE_ICONV_H)
-check_library_exists(iconv iconv "" HAVE_ICONV_LIB)
-if(HAVE_ICONV_LIB)
- set(CMAKE_REQUIRED_LIBRARIES iconv)
+if(Iconv_FOUND)
+ set(HAVE_ICONV 1)
endif()
-check_function_exists(iconv HAVE_ICONV)
check_function_exists(lstat HAVE_LSTAT)
if(NOT HAVE_LSTAT)
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 5b97cf5f40..4e0819cc0e 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -158,8 +158,8 @@ else()
endif()
endif()
-if(HAVE_ICONV_LIB)
- list(APPEND NVIM_LINK_LIBRARIES iconv)
+if(Iconv_LIBRARIES)
+ list(APPEND NVIM_LINK_LIBRARIES ${Iconv_LIBRARIES})
endif()
# Put these last on the link line, since multiple things may depend on them.