mirror of
https://github.com/transmission/transmission
synced 2025-01-30 19:03:04 +00:00
CMake fixes for universal builds on Mac (#2044)
* Use CMake to build libevent on all platforms * Pass Mac-specific flags down to 3rd-party projects
This commit is contained in:
parent
775e30eefd
commit
81147a8fbb
2 changed files with 18 additions and 20 deletions
|
@ -304,26 +304,14 @@ endif()
|
|||
|
||||
set(THIRD_PARTY_DIR ${CMAKE_SOURCE_DIR}/third-party)
|
||||
|
||||
if(WIN32)
|
||||
tr_add_external_auto_library(EVENT2 libevent event
|
||||
CMAKE_ARGS
|
||||
"-DEVENT__DISABLE_OPENSSL:BOOL=ON"
|
||||
"-DEVENT__DISABLE_SAMPLES:BOOL=ON"
|
||||
"-DEVENT__LIBRARY_TYPE:STRING=STATIC")
|
||||
else()
|
||||
set(EVENT2_CONFIGURE_FLAGS)
|
||||
if(APPLE)
|
||||
if(CRYPTO_PKG STREQUAL "openssl")
|
||||
list(APPEND EVENT2_CONFIGURE_FLAGS "CPPFLAGS=-I${CRYPTO_INCLUDE_DIRS}")
|
||||
else()
|
||||
list(APPEND EVENT2_CONFIGURE_FLAGS "CPPFLAGS=-I${THIRD_PARTY_DIR}/openssl/include")
|
||||
endif()
|
||||
endif()
|
||||
tr_add_external_auto_library(EVENT2 libevent event
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND "<SOURCE_DIR>/autogen.sh"
|
||||
COMMAND "<SOURCE_DIR>/configure" "--prefix=<INSTALL_DIR>" "--disable-shared" "--disable-openssl" "--disable-samples" ${EVENT2_CONFIGURE_FLAGS})
|
||||
endif()
|
||||
tr_add_external_auto_library(EVENT2 libevent event
|
||||
CMAKE_ARGS
|
||||
-DEVENT__DISABLE_OPENSSL:BOOL=ON
|
||||
-DEVENT__DISABLE_BENCHMARK:BOOL=ON
|
||||
-DEVENT__DISABLE_TESTS:BOOL=ON
|
||||
-DEVENT__DISABLE_REGRESS:BOOL=ON
|
||||
-DEVENT__DISABLE_SAMPLES:BOOL=ON
|
||||
-DEVENT__LIBRARY_TYPE:STRING=STATIC)
|
||||
|
||||
tr_add_external_auto_library(NATPMP libnatpmp natpmp)
|
||||
if(NOT USE_SYSTEM_NATPMP)
|
||||
|
|
|
@ -88,6 +88,15 @@ macro(tr_add_external_auto_library ID DIRNAME LIBNAME)
|
|||
set(${ID}_INCLUDE_DIRS ${${ID}_INCLUDE_DIR})
|
||||
set(${ID}_LIBRARIES ${${ID}_LIBRARY})
|
||||
|
||||
set(${ID}_EXT_PROJ_CMAKE_ARGS)
|
||||
if(APPLE)
|
||||
string(REPLACE ";" "$<SEMICOLON>" ${ID}_CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
|
||||
list(APPEND ${ID}_EXT_PROJ_CMAKE_ARGS
|
||||
"-DCMAKE_OSX_ARCHITECTURES:STRING=${${ID}_CMAKE_OSX_ARCHITECTURES}"
|
||||
"-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET}"
|
||||
"-DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT}")
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(
|
||||
${${ID}_UPSTREAM_TARGET}
|
||||
URL "${CMAKE_SOURCE_DIR}/third-party/${DIRNAME}"
|
||||
|
@ -101,6 +110,7 @@ macro(tr_add_external_auto_library ID DIRNAME LIBNAME)
|
|||
"-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}"
|
||||
"-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}"
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>"
|
||||
${${ID}_EXT_PROJ_CMAKE_ARGS}
|
||||
BUILD_BYPRODUCTS "${${ID}_LIBRARY}"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue