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_TINYXML "use built-in TinyXML2" ON)
option (USE_INTERNAL_EASYLOGGING "use built-in Easylogging++" ON) option (USE_INTERNAL_EASYLOGGING "use built-in Easylogging++" ON)
option (BUILD_SHARED_LIBS "build internal libraries as shared" OFF) option (BUILD_SHARED_LIBS "build internal libraries as shared" OFF)
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) option (ENABLE_NLS "compile with Native Language Support (using gettext)" ON)
endif()
option (INSTALL_LIBENCFS "install libencfs" OFF) option (INSTALL_LIBENCFS "install libencfs" OFF)
option (LINT "enable lint output" OFF) option (LINT "enable lint output" OFF)
@ -104,6 +108,10 @@ if (CYGWIN)
endif() endif()
# Check for OpenSSL. # 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) find_package (OpenSSL REQUIRED)
include_directories (${OPENSSL_INCLUDE_DIR}) include_directories (${OPENSSL_INCLUDE_DIR})

View File

@ -19,6 +19,10 @@ Or following are the detailed steps to build EncFS:
cmake .. cmake ..
make 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 Optional, but strongly recommended, is running the unit and integration
tests to verify that the generated binaries work as expected. Unit tests to verify that the generated binaries work as expected. Unit
tests will run almost instantly: tests will run almost instantly:

View File

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

View File

@ -2,32 +2,38 @@
# #
# FUSE_INCLUDE_DIR - where to find fuse.h, etc. # FUSE_INCLUDE_DIR - where to find fuse.h, etc.
# FUSE_LIBRARIES - List of libraries when using FUSE. # FUSE_LIBRARIES - List of libraries when using FUSE.
# FUSE_ROOT_DIR - Additional search path.
# FUSE_FOUND - True if FUSE lib is found. # FUSE_FOUND - True if FUSE lib is found.
# check if already in cache, be silent # check if already in cache, be silent
if (FUSE_INCLUDE_DIR) if (FUSE_INCLUDE_DIR AND FUSE_LIBRARIES)
SET (FUSE_FIND_QUIETLY TRUE) SET (FUSE_FIND_QUIETLY TRUE)
endif (FUSE_INCLUDE_DIR) endif ()
if (APPLE) if (APPLE)
set (FUSE_NAMES libosxfuse.dylib fuse) set (FUSE_NAMES libosxfuse.dylib fuse)
set (FUSE_SUFFIXES osxfuse fuse) set (FUSE_SUFFIXES osxfuse fuse)
else (APPLE) else ()
set (FUSE_NAMES fuse refuse) set (FUSE_NAMES fuse refuse)
set (FUSE_SUFFIXES fuse refuse) set (FUSE_SUFFIXES fuse refuse)
endif (APPLE) endif ()
# find includes # find include
find_path (FUSE_INCLUDE_DIR fuse.h find_path (
PATHS /opt /opt/local /usr/pkg FUSE_INCLUDE_DIR fuse.h
PATH_SUFFIXES ${FUSE_SUFFIXES}) PATHS /opt /opt/local /usr /usr/local /usr/pkg ${FUSE_ROOT_DIR} ENV FUSE_ROOT_DIR
PATH_SUFFIXES include ${FUSE_SUFFIXES})
# find lib # 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") include ("FindPackageHandleStandardArgs")
find_package_handle_standard_args ("FUSE" DEFAULT_MSG find_package_handle_standard_args (
"FUSE" DEFAULT_MSG
FUSE_INCLUDE_DIR FUSE_LIBRARIES) FUSE_INCLUDE_DIR FUSE_LIBRARIES)
mark_as_advanced (FUSE_INCLUDE_DIR FUSE_LIBRARIES) mark_as_advanced (FUSE_INCLUDE_DIR FUSE_LIBRARIES)