Improve cross-compilation support when using CMake

This commit is contained in:
Mike Gelfand 2014-12-20 22:28:43 +00:00
parent dee7bc9b6a
commit eee49af2b4
3 changed files with 13 additions and 1 deletions

View File

@ -305,11 +305,14 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
endif()
set(NEEDED_HEADERS
libintl.h
stdbool.h
sys/statvfs.h
xfs/xfs.h)
if(ENABLE_NLS)
list(APPEND NEEDED_HEADERS libintl.h)
endif()
foreach(H ${NEEDED_HEADERS})
tr_make_id("${H}" H_ID)
check_include_file(${H} HAVE_${H_ID})
@ -356,6 +359,13 @@ endforeach()
# endif()
# endif()
if(ENABLE_NLS)
check_library_exists(intl libintl_gettext "" HAVE_LIBINTL)
if(HAVE_LIBINTL)
set(LIBINTL_LIBRARY intl)
endif()
endif()
check_library_exists(m sqrt "" HAVE_LIBM)
if(HAVE_LIBM)
set(LIBM_LIBRARY m)

View File

@ -62,6 +62,7 @@ macro(tr_add_external_auto_library ID LIBNAME)
${ARGN}
PREFIX "${${ID}_PREFIX}"
CMAKE_ARGS
"-DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}"
"-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}"
"-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}"
"-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}"

View File

@ -202,6 +202,7 @@ target_link_libraries(${TR_NAME}
${MINIUPNPC_LIBRARIES}
${DHT_LIBRARIES}
${UTP_LIBRARIES}
${LIBINTL_LIBRARY}
${LIBM_LIBRARY}
)