You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.0 KiB
66 lines
2.0 KiB
macro(type_to_varname _type _varname)
|
|
string( TOUPPER "${_type}" ${_varname} )
|
|
string( REPLACE " " "_" "${${_varname}}" ${_varname} )
|
|
string( REPLACE "*" "P" "${${_varname}}" ${_varname} )
|
|
endmacro( type_to_varname )
|
|
|
|
# A helper macro to determin the type used as socklen_t
|
|
macro( check_socklen_t_type _var )
|
|
foreach( _type ${ARGN})
|
|
type_to_varname( "HAVE_${_type}_AS_SOCKLEN_T" _type_var)
|
|
check_cxx_source_compiles(
|
|
"#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
int main(){
|
|
${_type} len;
|
|
getpeername(0,0,&len);
|
|
}"
|
|
${_type_var}
|
|
)
|
|
if( ${_type_var} )
|
|
set( ${_var} ${_type} CACHE INTERNAL "A socklen_t type" )
|
|
break()
|
|
endif()
|
|
endforeach()
|
|
endmacro( check_socklen_t_type )
|
|
|
|
if( UNIX )
|
|
|
|
check_symbol_exists( SIG_IGN "signal.h" HAVE_SIG_IGN )
|
|
if( NOT HAVE_SIG_IGN )
|
|
tde_message_fatal( "Systems without SIG_IGN definition are not supported" )
|
|
endif()
|
|
|
|
# Check which type we should use as socklen_t
|
|
check_socklen_t_type( QT_SOCKLEN_T socklen_t size_t int )
|
|
if( NOT QT_SOCKLEN_T )
|
|
tde_message_fatal( "Failed to determin typy used as socklen_t" )
|
|
endif()
|
|
|
|
check_symbol_exists( snprintf "stdio.h" QT_SNPRINTF )
|
|
check_symbol_exists( vsnprintf "stdarg.h;stdio.h" QT_VSNPRINTF )
|
|
|
|
tde_save_and_set( CMAKE_REQUIRED_LIBRARIES "Xext" )
|
|
check_symbol_exists( XShmCreateImage "X11/Xlib.h;X11/extensions/XShm.h" QT_MITSHM )
|
|
tde_restore( CMAKE_REQUIRED_LIBRARIES )
|
|
|
|
configure_file( qplatformdefs_unix.h.cmake qplatformdefs.h @ONLY )
|
|
else()
|
|
tde_message_fatal(
|
|
"Unsupported platform"
|
|
"Currently tqt cmake supports autoconfiguration only for unix platforms."
|
|
"Use -DTQT_PLATFORM=platform to specify specify another platform."
|
|
)
|
|
endif()
|
|
|
|
configure_file( qmake.conf.cmake qmake.conf @ONLY )
|
|
|
|
if( BUILD_TQMAKE )
|
|
install(
|
|
FILES
|
|
${CMAKE_CURRENT_BINARY_DIR}/qplatformdefs.h
|
|
${CMAKE_CURRENT_BINARY_DIR}/qmake.conf
|
|
DESTINATION "${QT_INSTALL_DATA}/mkspecs/local/"
|
|
)
|
|
endif( BUILD_TQMAKE )
|