cmake FUSE & OpenSSL finding (#591)

This commit is contained in:
Ben RUBSON 2020-03-03 22:48:28 +01:00 committed by GitHub
parent 1486e50a45
commit 3bf25fb916
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 20 deletions

View File

@ -27,7 +27,11 @@ option (BUILD_UNIT_TESTS "build EncFS unit tests" ON)
option (USE_INTERNAL_TINYXML "use built-in TinyXML2" ON)
option (USE_INTERNAL_EASYLOGGING "use built-in Easylogging++" ON)
option (BUILD_SHARED_LIBS "build internal libraries as shared" OFF)
option (ENABLE_NLS "compile with Native Language Support (using gettext)" ON)
if (APPLE)
option (ENABLE_NLS "compile with Native Language Support (using gettext)" OFF)
else()
option (ENABLE_NLS "compile with Native Language Support (using gettext)" ON)
endif()
option (INSTALL_LIBENCFS "install libencfs" OFF)
option (LINT "enable lint output" OFF)
@ -104,6 +108,10 @@ if (CYGWIN)
endif()
# Check for OpenSSL.
if (APPLE AND NOT DEFINED OPENSSL_ROOT_DIR)
# Search both Brew and Macports
set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl;/opt/local")
endif()
find_package (OpenSSL REQUIRED)
include_directories (${OPENSSL_INCLUDE_DIR})

View File

@ -19,6 +19,10 @@ Or following are the detailed steps to build EncFS:
cmake ..
make
If CMake can't find FUSE or OpenSSL, you can use the following options:
cmake .. -DFUSE_ROOT_DIR=/pathto/fuse -DOPENSSL_ROOT_DIR=/pathto/openssl
Optional, but strongly recommended, is running the unit and integration
tests to verify that the generated binaries work as expected. Unit
tests will run almost instantly:

View File

@ -11,10 +11,6 @@ if [[ "$CHECK" == "true" ]]; then
CFG="-DLINT=ON $CFG"
fi
if uname -s | grep -q Darwin; then
CFG="-DENABLE_NLS=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl $CFG"
fi
if [[ ! -d build ]]
then
mkdir build

View File

@ -1,33 +1,39 @@
# Find the FUSE includes and library
#
# FUSE_INCLUDE_DIR - where to find fuse.h, etc.
# FUSE_LIBRARIES - List of libraries when using FUSE.
# FUSE_FOUND - True if FUSE lib is found.
# FUSE_INCLUDE_DIR - where to find fuse.h, etc.
# FUSE_LIBRARIES - List of libraries when using FUSE.
# FUSE_ROOT_DIR - Additional search path.
# FUSE_FOUND - True if FUSE lib is found.
# check if already in cache, be silent
if (FUSE_INCLUDE_DIR)
SET (FUSE_FIND_QUIETLY TRUE)
endif (FUSE_INCLUDE_DIR)
if (FUSE_INCLUDE_DIR AND FUSE_LIBRARIES)
SET (FUSE_FIND_QUIETLY TRUE)
endif ()
if (APPLE)
set (FUSE_NAMES libosxfuse.dylib fuse)
set (FUSE_SUFFIXES osxfuse fuse)
else (APPLE)
else ()
set (FUSE_NAMES fuse refuse)
set (FUSE_SUFFIXES fuse refuse)
endif (APPLE)
endif ()
# find includes
find_path (FUSE_INCLUDE_DIR fuse.h
PATHS /opt /opt/local /usr/pkg
PATH_SUFFIXES ${FUSE_SUFFIXES})
# find include
find_path (
FUSE_INCLUDE_DIR fuse.h
PATHS /opt /opt/local /usr /usr/local /usr/pkg ${FUSE_ROOT_DIR} ENV FUSE_ROOT_DIR
PATH_SUFFIXES include ${FUSE_SUFFIXES})
# find lib
find_library (FUSE_LIBRARIES NAMES ${FUSE_NAMES})
find_library (
FUSE_LIBRARIES
NAMES ${FUSE_NAMES}
PATHS /opt /opt/local /usr /usr/local /usr/pkg ${FUSE_ROOT_DIR} ENV FUSE_ROOT_DIR
PATH_SUFFIXES lib)
include ("FindPackageHandleStandardArgs")
find_package_handle_standard_args ("FUSE" DEFAULT_MSG
find_package_handle_standard_args (
"FUSE" DEFAULT_MSG
FUSE_INCLUDE_DIR FUSE_LIBRARIES)
mark_as_advanced (FUSE_INCLUDE_DIR FUSE_LIBRARIES)