Skip to content

Commit

Permalink
Update cmake (#309)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Ben RUBSON authored and rfjakob committed May 28, 2017
1 parent c270963 commit f75854c
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 24 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ env:
- secure: "KuAAwjiIqkk4vqSX/M3ZZIvQs6edm+tV8IADiklTUYZIFyxu8FgZ6RbDdMD2sef5bNZA1OZhlcbeRtiKff5CfMtvzc607Lg3NUkpi+ShMynWgqS/e0uCMf9ogEJlUiZMxf4juBi7v6DyMl/WV6pAdJmdfHtzcj8GF2mgTfQjkO8="

before_script:
- sh ci/install-cmake.sh
- sudo modprobe fuse
- mkdir build
- cd build
- cmake ..
- ../ci/cmake/bin/cmake --version
- ../ci/cmake/bin/cmake ..

script:
- if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make && ./checkops && cd .. && ./test.sh ; fi
- if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make && make check ; fi

addons:
coverity_scan:
Expand All @@ -42,6 +44,6 @@ addons:
packages:
- attr
- clang
- cmake
- fuse
- libfuse-dev
- gettext
27 changes: 21 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
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)

set (ENCFS_MAJOR 1)
Expand Down Expand Up @@ -245,15 +249,26 @@ endif (POD2MAN)

# Tests
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
COMMAND checkops)

find_program (PERL_PROGRAM perl)
if (PERL_PROGRAM)
file(GLOB pl_test_files "tests/*.t.pl")
#add_test (NAME scriptedtests
# COMMAND ${PERL_PROGRAM} -I ${CMAKE_CURRENT_LIST_DIR}
# -MTest::Harness
# -e "$$Test::Harness::verbose=1; runtests @ARGV;"
# ${pl_test_files})
add_test (NAME scriptedtests
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${PERL_PROGRAM}
-MTest::Harness
-e "$$Test::Harness::verbose=1; runtests @ARGV;"
${pl_test_files})
endif (PERL_PROGRAM)
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Optional, but strongly recommended, is running the test suite
to verify that the generated binaries work as expected
(runtime: 20 seconds)

make test
make check

The compilation process creates two executables, encfs and encfsctl in
the encfs directory. You can install to in a system directory via
Expand All @@ -46,7 +46,7 @@ EncFS depends on a number of libraries:
* tinyxml2 : for reading and writing XML configuration files
* gettext : 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

Compiling on Debian and Ubuntu
Expand Down
Binary file added ci/cmake-3.0.2-Linux-x86_64.tar.gz
Binary file not shown.
6 changes: 3 additions & 3 deletions ci/install-cmake.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set -x
set -e
if [ ! -e ci/cmake/bin/cmake ]; then
wget http://www.cmake.org/files/v3.1/cmake-3.1.3-Linux-x86_64.tar.gz
tar -xzf cmake-3.1.3-Linux-x86_64.tar.gz
mv cmake-3.1.3-Linux-x86_64 ci/cmake
#wget http://www.cmake.org/files/v3.1/cmake-3.1.0-Linux-x86_64.tar.gz
tar -xzf ci/cmake-3.0.2-Linux-x86_64.tar.gz
mv cmake-3.0.2-Linux-x86_64 ci/cmake
fi
59 changes: 59 additions & 0 deletions cmake/FindIntl.cmake
Original file line number Diff line number Diff line change
@@ -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 changes: 0 additions & 10 deletions test.sh

This file was deleted.

0 comments on commit f75854c

Please sign in to comment.