Skip to content

Commit

Permalink
improved macOS portability
Browse files Browse the repository at this point in the history
  • Loading branch information
d99kris committed Mar 10, 2024
1 parent f44803e commit e21522d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 23 deletions.
19 changes: 15 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ include(CheckIncludeFile)
set(CMAKE_CXX_STANDARD 14)
message(STATUS "Using cmake ${CMAKE_VERSION}")

# Modules
include(CheckIncludeFiles)

# Ccache
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
Expand Down Expand Up @@ -204,10 +207,18 @@ endif()
# Dependency platform specifics
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if (NOT HAS_CUSTOM_LIBETPAN)
FIND_LIBRARY(CARBON_LIBRARY CoreFoundation)
FIND_LIBRARY(CARBON_LIBRARY Security)
FIND_LIBRARY(CARBON_LIBRARY CFNetwork)
target_link_libraries(nmail PUBLIC z iconv "-framework CoreFoundation" "-framework Security" "-framework CFNetwork")
find_package(ZLIB REQUIRED)
find_library(ICONV_LIBRARY iconv REQUIRED)
find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED)
find_library(SECURITY_LIBRARY Security REQUIRED)
target_link_libraries(nmail PUBLIC ${ZLIB_LIBRARIES} "${ICONV_LIBRARY}" "${COREFOUNDATION_LIBRARY}" "${SECURITY_LIBRARY}")

set(CMAKE_REQUIRED_INCLUDES ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES})
check_include_files("CFNetwork/CFNetwork.h" HAVE_CFNETWORK LANGUAGE C)
if (HAVE_CFNETWORK)
find_library(CFNETWORK_LIBRARY CFNetwork REQUIRED)
target_link_libraries(nmail PUBLIC "${CFNETWORK_LIBRARY}")
endif()
endif()
endif()

Expand Down
18 changes: 7 additions & 11 deletions ext/libetpan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -357,15 +357,6 @@ find_path(CYRUS_SASL_INCLUDE_DIR sasl/sasl.h PATH_SUFFIXES include)
find_package_handle_standard_args(sasl2 DEFAULT_MSG CYRUS_SASL_LIBRARY CYRUS_SASL_INCLUDE_DIR)
target_include_directories(${LIBNAME} PRIVATE ${CYRUS_SASL_INCLUDE_DIR})

# Find Dependencies - System Libs
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_library(CARBON_LIBRARY CoreFoundation REQUIRED)
if(${HAVE_CFNETWORK})
find_library(CARBON_LIBRARY CFNetwork REQUIRED)
endif()
find_library(CARBON_LIBRARY Security REQUIRED)
endif()

# Find Dependencies - zlib
find_package(ZLIB REQUIRED)
target_include_directories(${LIBNAME} PRIVATE ${ZLIB_INCLUDE_DIRS})
Expand All @@ -378,9 +369,14 @@ target_link_libraries(${LIBNAME} PUBLIC ${CURL_LIBRARIES} ${EXPAT_LIBRARIES} ${Z

# Linking (macOS)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(${LIBNAME} PUBLIC iconv "-framework CoreFoundation" "-framework Security")
find_library(ICONV_LIBRARY iconv REQUIRED)
find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED)
find_library(SECURITY_LIBRARY Security REQUIRED)

target_link_libraries(${LIBNAME} PUBLIC "${ICONV_LIBRARY}" "${COREFOUNDATION_LIBRARY}" "${SECURITY_LIBRARY}")
if(${HAVE_CFNETWORK})
target_link_libraries(${LIBNAME} PUBLIC "-framework CFNetwork")
find_library(CFNETWORK_LIBRARY CFNetwork REQUIRED)
target_link_libraries(${LIBNAME} PUBLIC "${CFNETWORK_LIBRARY}")
endif()
endif()

Expand Down
2 changes: 1 addition & 1 deletion src/nmail.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
.TH NMAIL "1" "March 2024" "nmail v4.53" "User Commands"
.TH NMAIL "1" "March 2024" "nmail v4.54" "User Commands"
.SH NAME
nmail \- ncurses mail
.SH SYNOPSIS
Expand Down
5 changes: 0 additions & 5 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,6 @@ void Util::Move(const std::string& p_From, const std::string& p_To)
apathy::Path::move(p_From, p_To);
}

void Util::Touch(const std::string& p_Path)
{
utimensat(0, p_Path.c_str(), NULL, 0);
}

std::string Util::GetApplicationDir()
{
return m_ApplicationDir;
Expand Down
1 change: 0 additions & 1 deletion src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ class Util
static void MkDir(const std::string& p_Path);
static void RmDir(const std::string& p_Path);
static void Move(const std::string& p_From, const std::string& p_To);
static void Touch(const std::string& p_Path);
static std::string GetApplicationDir();
static void SetApplicationDir(const std::string& p_Path);
static std::string GetTempDir();
Expand Down
2 changes: 1 addition & 1 deletion src/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "version.h"

#define NMAIL_VERSION "4.53"
#define NMAIL_VERSION "4.54"

std::string Version::GetBuildOs()
{
Expand Down

0 comments on commit e21522d

Please sign in to comment.