2014-01-31 06:39:15 -07:00
|
|
|
cmake_minimum_required (VERSION 2.6)
|
|
|
|
project (NEOVIM)
|
|
|
|
|
2014-02-24 13:54:45 -07:00
|
|
|
# Point CMake at any custom modules we may ship
|
|
|
|
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
|
|
|
|
2014-01-31 06:39:15 -07:00
|
|
|
set(NEOVIM_VERSION_MAJOR 0)
|
|
|
|
set(NEOVIM_VERSION_MINOR 0)
|
|
|
|
set(NEOVIM_VERSION_PATCH 0)
|
|
|
|
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
|
2014-02-27 05:27:20 -07:00
|
|
|
# If the C compiler is some GNU-alike, use the gnu99 standard and enable all warnings.
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
2014-03-02 15:20:56 -07:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wall -Wextra -pedantic -Wno-unused-parameter -std=gnu99")
|
2014-02-28 04:09:04 -07:00
|
|
|
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
2014-03-02 15:20:56 -07:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wall -Wextra -pedantic -Wno-unused-parameter -std=gnu99")
|
2014-02-27 05:27:20 -07:00
|
|
|
endif(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
|
|
|
|
add_definitions(-DHAVE_CONFIG_H)
|
2014-01-31 06:39:15 -07:00
|
|
|
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
|
|
|
# cmake automatically appends -g to the compiler flags
|
|
|
|
set(DEBUG 1)
|
|
|
|
else()
|
|
|
|
set(DEBUG 0)
|
|
|
|
endif()
|
|
|
|
|
2014-02-26 11:48:26 -07:00
|
|
|
if(DEFINED $ENV{VALGRIND_CHECK})
|
|
|
|
add_definitions(-DEXITFREE)
|
|
|
|
endif()
|
|
|
|
|
2014-02-26 03:06:59 -07:00
|
|
|
# Modules used by platform auto-detection
|
|
|
|
include(CheckLibraryExists)
|
|
|
|
|
2014-02-24 11:52:12 -07:00
|
|
|
# Determine platform's threading library. Set CMAKE_THREAD_PREFER_PTHREAD
|
|
|
|
# explicitly to indicate a strong preference for pthread. It is an error to not
|
|
|
|
# have pthread installed even if, for example, the Win32 threading API is found.
|
|
|
|
set(CMAKE_THREAD_PREFER_PTHREAD ON)
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
if(NOT CMAKE_USE_PTHREADS_INIT)
|
|
|
|
message(SEND_ERROR "The pthread library must be installed on your system.")
|
|
|
|
endif(NOT CMAKE_USE_PTHREADS_INIT)
|
|
|
|
|
2014-02-26 03:06:59 -07:00
|
|
|
# Detect if clock_gettime exists in -lrt. If so we need to link with it because
|
|
|
|
# the static libuv doesn't but uses clock_gettime.
|
|
|
|
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
|
|
|
|
|
2014-02-26 05:55:43 -07:00
|
|
|
find_package(LibIntl)
|
2014-02-28 03:01:31 -07:00
|
|
|
if(LibIntl_FOUND)
|
|
|
|
include_directories(${LibIntl_INCLUDE_DIR})
|
|
|
|
endif()
|
2014-02-26 05:55:43 -07:00
|
|
|
|
2014-02-24 13:57:04 -07:00
|
|
|
# Require libuv
|
|
|
|
find_package(LibUV REQUIRED)
|
2014-02-24 13:59:03 -07:00
|
|
|
include_directories(${LibUV_INCLUDE_DIRS})
|
2014-02-24 13:57:04 -07:00
|
|
|
|
2014-02-26 03:06:59 -07:00
|
|
|
include_directories ("${PROJECT_BINARY_DIR}/config")
|
2014-01-31 06:39:15 -07:00
|
|
|
|
2014-02-22 08:30:50 -07:00
|
|
|
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
|
|
|
|
2014-01-31 06:39:15 -07:00
|
|
|
add_subdirectory(config)
|
2014-02-23 06:48:03 -07:00
|
|
|
add_subdirectory(src)
|