Skip to content

Commit

Permalink
Got it compile on Mac OS X.
Browse files Browse the repository at this point in the history
Still need to cleanup
  • Loading branch information
Claudius Link committed Jul 3, 2016
1 parent 213f430 commit 44c86c6
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ set (XMail_VERSION_MINOR 27)
#

# On Linux XMails expcts
add_definitions( -D__LINUX__)
add_definitions( -DHAS_SYSMACHINE)
#add_definitions( -D__UNIX__
# -D_REENTRANT=1 -D_THREAD_SAFE=1
Expand All @@ -27,8 +26,32 @@ set(LIBS ${LIBS} ${OPENSSL_LIBRARIES})
find_package (Threads REQUIRED)
set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT})

set( MAINSRC MainLinux.cpp )
set( SYSSRCS SysDepLinux.cpp SysDepUnix.cpp )
INCLUDE (CheckIncludeFiles)
# usage: CHECK_INCLUDE_FILES (<header> <RESULT_VARIABLE> )
check_include_files(kvm.h HAS_KVM_H )

message( "CMAKE_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}" )
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_definitions( -D__BSD__)
add_definitions( -D__DARWIN__)
add_definitions( -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_POSIX_PTHREAD_SEMANTICS )
## I don't like this
add_definitions( -D__DARWIN_10_5__)
set( MAINSRC MainBSD.cpp )
set( SYSSRCS SysDepBSD.cpp SysDepUnix.cpp )
set(LIBS ${LIBS} -lc )
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions( -D__LINUX__)
set( MAINSRC MainLinux.cpp )
set( SYSSRCS SysDepLinux.cpp SysDepUnix.cpp )
# Actually XMail has a bug. If SYS_HAS_SENDFILE is not defined
# SysSendFile will be defined twice
check_function_exists (sendfile SYS_HAS_SENDFILE)
if (SYS_HAS_SENDFILE)
#message( "SYS_HAS_SENDFILE: ${HAS_SYSMACHINE}" )
add_definitions( -DSYS_HAS_SENDFILE )
endif(SYS_HAS_SENDFILE)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

include (CheckFunctionExists)
check_function_exists (eventfd HAS_EVENTFD)
Expand All @@ -39,13 +62,6 @@ else()
set( SYSSRCS ${SYSSRCS} SysOsEventfd_pipe.cpp )
endif(HAS_EVENTFD)

# Ectually XMail has a bug. If SYS_HAS_SENDFILE is not defined
# SysSendFile will be defined twice
check_function_exists (sendfile SYS_HAS_SENDFILE)
if (SYS_HAS_SENDFILE)
#message( "SYS_HAS_SENDFILE: ${HAS_SYSMACHINE}" )
add_definitions( -DSYS_HAS_SENDFILE )
endif(SYS_HAS_SENDFILE)

set( COMMONSRCS
Base64Enc.cpp
Expand Down Expand Up @@ -75,11 +91,7 @@ set( SVRSRCS ${MAINSRC}
Hash.cpp Array.cpp
)


set( CCLNSRCS CTRLClient.cpp
)


set( CCLNSRCS CTRLClient.cpp )

add_executable( MkMachDep MkMachDep.cpp )

Expand All @@ -91,7 +103,8 @@ add_custom_command (

set(LIBS ${LIBS} -ldl )

add_library(common_objects OBJECT ${COMMONSRCS} )
add_library(common_objects OBJECT ${COMMONSRCS}
${CMAKE_CURRENT_BINARY_DIR}/SysMachine.h)
add_library(system_objects OBJECT ${SYSSRCS}
${CMAKE_CURRENT_BINARY_DIR}/SysMachine.h )

Expand Down

0 comments on commit 44c86c6

Please sign in to comment.