Build fixes for FreeBSD. Find libraries and make sure correct constness on different platforms

This commit is contained in:
Micke Prag 2011-03-11 10:41:46 +00:00
parent 6c4163f831
commit 35c7fc13a1
2 changed files with 21 additions and 2 deletions

View file

@ -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 )

View file

@ -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);