Add some default search paths for libraries on Mac OS X

This commit is contained in:
Sebastian Messmer 2016-02-15 20:01:13 +01:00
parent 3bd43506c2
commit c889366619
4 changed files with 18 additions and 3 deletions

View File

@ -88,10 +88,13 @@ Build & Install
$ sudo make install
You can pass the following variables to CMake (using *-Dvariablename=value*):
You can pass the following variables to the *cmake* command (using *-Dvariablename=value*):
- -D**CMAKE_BUILD_TYPE**=[Release|Debug]: Whether to run code optimization or add debug symbols. Default: Release
- -D**BUILD_TESTING**=[on|off]: Whether to build the test cases (can take a long time). Default: off
Troubleshooting
---------------
On most systems, CMake should find the libraries automatically.
If this doesn't work for you, you can use the following CMake variables:
- -D**FUSE_LIB_PATH**=[path]: Path to the directory containing the fuse library (or osxfuse library on Mac)

View File

@ -18,7 +18,9 @@ target_activate_cpp14(${PROJECT_NAME})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_FIND_FRAMEWORK LAST)
set(FUSE_LIB_NAME "osxfuse")
else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Add a default location for homebrew-installed openssl on Mac OS X to include search path
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC /usr/local/include/osxfuse)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(FUSE_LIB_NAME "fuse")
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

View File

@ -45,7 +45,11 @@ function(target_add_boost TARGET)
REQUIRED
COMPONENTS ${ARGN})
target_include_directories(${TARGET} SYSTEM PRIVATE ${Boost_INCLUDE_DIRS})
target_link_libraries(${TARGET} PUBLIC ${Boost_LIBRARIES} rt) # Also link to rt, because boost thread needs that.
target_link_libraries(${TARGET} PUBLIC ${Boost_LIBRARIES})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# Also link to rt, because boost thread needs that.
target_link_libraries(${TARGET} PUBLIC rt)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
endfunction(target_add_boost)
##################################################

View File

@ -7,6 +7,12 @@ project (scrypt C)
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILDTYPE)
set(SCRYPT_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BUILDTYPE}}")
set(SCRYPT_CPPFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BUILDTYPE}}")
# Add a default location for homebrew-installed openssl on Mac OS X to include search path
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(SCRYPT_CFLAGS "${SCRYPT_CFLAGS} -I/usr/local/opt/openssl/include")
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
ExternalProject_Add(scrypt_original
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0/scrypt
CONFIGURE_COMMAND /usr/bin/env CC=${CMAKE_C_COMPILER} CFLAGS=${SCRYPT_CFLAGS} CPPFLAGS=${SCRYPT_CPPFLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/scrypt-1.2.0/scrypt/configure --prefix=${CMAKE_BINARY_DIR}/vendor/scrypt/