Update cmake (#309)

* Update cmake

* Update cmake, make Travis use it

* Enable all tests in a single command : make check

* Make cmake flawlessly run with Debian jessie cmake 3.0.2

* Make Travis use our own cmake 3.0.2 compiled version

* Typo in preferred version

* Be sure travis will have gettext
This commit is contained in:
Ben RUBSON 2017-05-28 16:20:21 +02:00 committed by rfjakob
parent c270963df8
commit f75854cd31
7 changed files with 90 additions and 24 deletions

View File

@ -18,13 +18,15 @@ env:
- secure: "KuAAwjiIqkk4vqSX/M3ZZIvQs6edm+tV8IADiklTUYZIFyxu8FgZ6RbDdMD2sef5bNZA1OZhlcbeRtiKff5CfMtvzc607Lg3NUkpi+ShMynWgqS/e0uCMf9ogEJlUiZMxf4juBi7v6DyMl/WV6pAdJmdfHtzcj8GF2mgTfQjkO8=" - secure: "KuAAwjiIqkk4vqSX/M3ZZIvQs6edm+tV8IADiklTUYZIFyxu8FgZ6RbDdMD2sef5bNZA1OZhlcbeRtiKff5CfMtvzc607Lg3NUkpi+ShMynWgqS/e0uCMf9ogEJlUiZMxf4juBi7v6DyMl/WV6pAdJmdfHtzcj8GF2mgTfQjkO8="
before_script: before_script:
- sh ci/install-cmake.sh
- sudo modprobe fuse - sudo modprobe fuse
- mkdir build - mkdir build
- cd build - cd build
- cmake .. - ../ci/cmake/bin/cmake --version
- ../ci/cmake/bin/cmake ..
script: script:
- if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make && ./checkops && cd .. && ./test.sh ; fi - if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make && make check ; fi
addons: addons:
coverity_scan: coverity_scan:
@ -42,6 +44,6 @@ addons:
packages: packages:
- attr - attr
- clang - clang
- cmake
- fuse - fuse
- libfuse-dev - libfuse-dev
- gettext

View File

@ -1,5 +1,9 @@
# 3.1 preferred, but we can often get by with 2.8. # 3.0.2 preferred, but we can often get by with 2.8.
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} LESS 3.0.2)
message(WARNING "You should use cmake 3.0.2 or newer for configuration to run correctly.")
endif()
project(EncFS C CXX) project(EncFS C CXX)
set (ENCFS_MAJOR 1) set (ENCFS_MAJOR 1)
@ -245,15 +249,26 @@ endif (POD2MAN)
# Tests # Tests
enable_testing() enable_testing()
if (CMAKE_CONFIGURATION_TYPES)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
--force-new-ctest-process --output-on-failure
--build-config "$<CONFIGURATION>")
else()
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
--force-new-ctest-process --output-on-failure)
endif()
add_test (NAME checkops add_test (NAME checkops
COMMAND checkops) COMMAND checkops)
find_program (PERL_PROGRAM perl) find_program (PERL_PROGRAM perl)
if (PERL_PROGRAM) if (PERL_PROGRAM)
file(GLOB pl_test_files "tests/*.t.pl") file(GLOB pl_test_files "tests/*.t.pl")
#add_test (NAME scriptedtests add_test (NAME scriptedtests
# COMMAND ${PERL_PROGRAM} -I ${CMAKE_CURRENT_LIST_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
# -MTest::Harness COMMAND ${PERL_PROGRAM}
# -e "$$Test::Harness::verbose=1; runtests @ARGV;" -MTest::Harness
# ${pl_test_files}) -e "$$Test::Harness::verbose=1; runtests @ARGV;"
${pl_test_files})
endif (PERL_PROGRAM) endif (PERL_PROGRAM)

View File

@ -21,7 +21,7 @@ Optional, but strongly recommended, is running the test suite
to verify that the generated binaries work as expected to verify that the generated binaries work as expected
(runtime: 20 seconds) (runtime: 20 seconds)
make test make check
The compilation process creates two executables, encfs and encfsctl in The compilation process creates two executables, encfs and encfsctl in
the encfs directory. You can install to in a system directory via the encfs directory. You can install to in a system directory via
@ -46,7 +46,7 @@ EncFS depends on a number of libraries:
* tinyxml2 : for reading and writing XML configuration files * tinyxml2 : for reading and writing XML configuration files
* gettext : internationalization support * gettext : internationalization support
* libintl : internationalization support * libintl : internationalization support
* cmake : version 3.2 or newer * cmake : version 3.0.2 (Debian jessie version) or newer
* GNU make or ninja-build : to run the build for cmake * GNU make or ninja-build : to run the build for cmake
Compiling on Debian and Ubuntu Compiling on Debian and Ubuntu

Binary file not shown.

View File

@ -1,7 +1,7 @@
set -x set -x
set -e set -e
if [ ! -e ci/cmake/bin/cmake ]; then if [ ! -e ci/cmake/bin/cmake ]; then
wget http://www.cmake.org/files/v3.1/cmake-3.1.3-Linux-x86_64.tar.gz #wget http://www.cmake.org/files/v3.1/cmake-3.1.0-Linux-x86_64.tar.gz
tar -xzf cmake-3.1.3-Linux-x86_64.tar.gz tar -xzf ci/cmake-3.0.2-Linux-x86_64.tar.gz
mv cmake-3.1.3-Linux-x86_64 ci/cmake mv cmake-3.0.2-Linux-x86_64 ci/cmake
fi fi

59
cmake/FindIntl.cmake Normal file
View File

@ -0,0 +1,59 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# FindIntl
# --------
#
# Find the Gettext libintl headers and libraries.
#
# This module reports information about the Gettext libintl
# installation in several variables. General variables::
#
# Intl_FOUND - true if the libintl headers and libraries were found
# Intl_INCLUDE_DIRS - the directory containing the libintl headers
# Intl_LIBRARIES - libintl libraries to be linked
#
# The following cache variables may also be set::
#
# Intl_INCLUDE_DIR - the directory containing the libintl headers
# Intl_LIBRARY - the libintl library (if any)
#
# .. note::
# On some platforms, such as Linux with GNU libc, the gettext
# functions are present in the C standard library and libintl
# is not required. ``Intl_LIBRARIES`` will be empty in this
# case.
#
# .. note::
# If you wish to use the Gettext tools (``msgmerge``,
# ``msgfmt``, etc.), use :module:`FindGettext`.
# Written by Roger Leigh <rleigh@codelibre.net>
# Find include directory
find_path(Intl_INCLUDE_DIR
NAMES "libintl.h"
DOC "libintl include directory")
mark_as_advanced(Intl_INCLUDE_DIR)
# Find all Intl libraries
find_library(Intl_LIBRARY "intl"
DOC "libintl libraries (if not in the C library)")
mark_as_advanced(Intl_LIBRARY)
#include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Intl
FOUND_VAR Intl_FOUND
REQUIRED_VARS Intl_INCLUDE_DIR
FAIL_MESSAGE "Failed to find Gettext libintl")
if(Intl_FOUND)
set(Intl_INCLUDE_DIRS "${Intl_INCLUDE_DIR}")
if(Intl_LIBRARY)
set(Intl_LIBRARIES "${Intl_LIBRARY}")
else()
unset(Intl_LIBRARIES)
endif()
endif()

10
test.sh
View File

@ -1,10 +0,0 @@
#!/bin/bash
set -eux
if [ ! -d build ]
then
./build.sh
fi
perl -MTest::Harness -e '$$Test::Harness::verbose=1; runtests @ARGV;' tests/*.t.pl