Build fixes for FreeBSD. Find libraries and make sure correct constness on different platforms
This commit is contained in:
parent
6c4163f831
commit
35c7fc13a1
2 changed files with 21 additions and 2 deletions
|
@ -44,6 +44,17 @@ ELSEIF (WIN32)
|
||||||
LIST(APPEND telldus-common_SRCS
|
LIST(APPEND telldus-common_SRCS
|
||||||
Socket_win.cpp
|
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)
|
ELSE (APPLE)
|
||||||
#### Linux ####
|
#### Linux ####
|
||||||
SET( telldus-common_TARGET telldus-common )
|
SET( telldus-common_TARGET telldus-common )
|
||||||
|
|
|
@ -45,7 +45,11 @@ std::wstring TelldusCore::charToWstring(const char *value) {
|
||||||
char *outString = (char*)new wchar_t[utf8Length+1];
|
char *outString = (char*)new wchar_t[utf8Length+1];
|
||||||
memset(outString, 0, sizeof(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;
|
char *outPointer = outString;
|
||||||
|
|
||||||
iconv_t convDesc = iconv_open(WCHAR_T_ENCODING, "UTF-8");
|
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];
|
char *outString = new char[outbytesLeft];
|
||||||
memset(outString, 0, sizeof(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;
|
char *outPointer = outString;
|
||||||
|
|
||||||
iconv_t convDesc = iconv_open("UTF-8", WCHAR_T_ENCODING);
|
iconv_t convDesc = iconv_open("UTF-8", WCHAR_T_ENCODING);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue