diff --git a/telldus-core/common/CMakeLists.txt b/telldus-core/common/CMakeLists.txt index f07e1504..aaa310ea 100644 --- a/telldus-core/common/CMakeLists.txt +++ b/telldus-core/common/CMakeLists.txt @@ -44,6 +44,17 @@ ELSEIF (WIN32) LIST(APPEND telldus-common_SRCS Socket_win.cpp ) +ELSEIF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + #### FreeBSD #### + SET( telldus-common_TARGET telldus-common ) + FIND_LIBRARY(ICONV_LIBRARY iconv) + ADD_DEFINITIONS( -D_FREEBSD ) + LIST(APPEND telldus-common_SRCS + Socket_unix.cpp + ) + LIST(APPEND telldus-common_LIBRARIES + ${ICONV_LIBRARY} + ) ELSE (APPLE) #### Linux #### SET( telldus-common_TARGET telldus-common ) diff --git a/telldus-core/common/Strings.cpp b/telldus-core/common/Strings.cpp index 7fee0582..ff786ae8 100644 --- a/telldus-core/common/Strings.cpp +++ b/telldus-core/common/Strings.cpp @@ -45,7 +45,11 @@ std::wstring TelldusCore::charToWstring(const char *value) { char *outString = (char*)new wchar_t[utf8Length+1]; memset(outString, 0, sizeof(wchar_t)*(utf8Length+1)); - char *inPointer = inString; +#ifdef _FREEBSD + const char *inPointer = inString; +#else + char *inPointer = inString; +#endif char *outPointer = outString; iconv_t convDesc = iconv_open(WCHAR_T_ENCODING, "UTF-8"); @@ -128,7 +132,11 @@ std::string TelldusCore::wideToString(const std::wstring &input) { char *outString = new char[outbytesLeft]; memset(outString, 0, sizeof(char)*(outbytesLeft)); - char *inPointer = inString; +#ifdef _FREEBSD + const char *inPointer = inString; +#else + char *inPointer = inString; +#endif char *outPointer = outString; iconv_t convDesc = iconv_open("UTF-8", WCHAR_T_ENCODING);