{"action":"created","issue":{"url":"https://api.github.com/repos/xoreos/xoreos/issues/92","labels_url":"https://api.github.com/repos/xoreos/xoreos/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/xoreos/xoreos/issues/92/comments","events_url":"https://api.github.com/repos/xoreos/xoreos/issues/92/events","html_url":"https://github.com/xoreos/xoreos/issues/92","id":93589159,"number":92,"title":"WIN32: Fix CMake definitions for iconv","user":{"login":"darkstar","id":43795,"avatar_url":"https://avatars.githubusercontent.com/u/43795?v=3","gravatar_id":"","url":"https://api.github.com/users/darkstar","html_url":"https://github.com/darkstar","followers_url":"https://api.github.com/users/darkstar/followers","following_url":"https://api.github.com/users/darkstar/following{/other_user}","gists_url":"https://api.github.com/users/darkstar/gists{/gist_id}","starred_url":"https://api.github.com/users/darkstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darkstar/subscriptions","organizations_url":"https://api.github.com/users/darkstar/orgs","repos_url":"https://api.github.com/users/darkstar/repos","events_url":"https://api.github.com/users/darkstar/events{/privacy}","received_events_url":"https://api.github.com/users/darkstar/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-07T17:52:01Z","updated_at":"2015-07-07T18:18:54Z","closed_at":"2015-07-07T18:18:53Z","body":"Here's a small patch which fixes compilation on Windows with MSVC:\r\n```\r\ndiff --git a/CMakeLists.txt b/CMakeLists.txt\r\nindex 31bc1b3..8d1d8ea 100644\r\n--- a/CMakeLists.txt\r\n+++ b/CMakeLists.txt\r\n@@ -30,7 +30,7 @@ elseif(CMAKE_HOST_UNIX)\r\n   string(REPLACE \"<LINK_LIBRARIES>\" \"-Wl,--start-group <LINK_LIBRARIES> -Wl,--end-group\" CMAKE_C_CREATE_SHARED_MODULE \"${CMAKE_C_CREATE_SHARED_MODULE}\")\r\n   string(REPLACE \"<LINK_LIBRARIES>\" \"-Wl,--start-group <LINK_LIBRARIES> -Wl,--end-group\" CMAKE_CXX_CREATE_SHARED_MODULE \"${CMAKE_CXX_CREATE_SHARED_MODULE}\")\r\n elseif(CMAKE_HOST_WIN32)\r\n-\r\n+  add_definitions(-DICONV_CONST=)\r\n else()\r\n   message(STATUS \"Unknown platform, maybe not supported\")\r\n endif() \r\n```\r\nProblem is that in ```common/encoding.cpp```, the symbol (macro) ```ICONV_CONST``` is used. However, on Win32 with MSVC, that symbol is not defined, leading to a compilation error. It should be defined to the empty string (just like for UNIX a few lines above in CMakeLists.txt) so that the preprocessor accepts it.\r\n\r\nAnother solution would be to drop the ICONST_CONV macro from ```common/encoding.cpp```"},"comment":{"url":"https://api.github.com/repos/xoreos/xoreos/issues/comments/119290507","html_url":"https://github.com/xoreos/xoreos/issues/92#issuecomment-119290507","issue_url":"https://api.github.com/repos/xoreos/xoreos/issues/92","id":119290507,"user":{"login":"DrMcCoy","id":156130,"avatar_url":"https://avatars.githubusercontent.com/u/156130?v=3","gravatar_id":"","url":"https://api.github.com/users/DrMcCoy","html_url":"https://github.com/DrMcCoy","followers_url":"https://api.github.com/users/DrMcCoy/followers","following_url":"https://api.github.com/users/DrMcCoy/following{/other_user}","gists_url":"https://api.github.com/users/DrMcCoy/gists{/gist_id}","starred_url":"https://api.github.com/users/DrMcCoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DrMcCoy/subscriptions","organizations_url":"https://api.github.com/users/DrMcCoy/orgs","repos_url":"https://api.github.com/users/DrMcCoy/repos","events_url":"https://api.github.com/users/DrMcCoy/events{/privacy}","received_events_url":"https://api.github.com/users/DrMcCoy/received_events","type":"User","site_admin":false},"created_at":"2015-07-07T18:18:53Z","updated_at":"2015-07-07T18:18:53Z","body":"Well, the ICONST_CONV macro is important, unfortunately, so dropping it is really not an options. The issue is that the iconv() signature can differ slightly for different implementations.\r\n\r\nGNU libiconv generally uses\r\n```size_t iconv(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);```\r\nwhile other implementations might use\r\n```size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);```\r\nNote the const at the second parameter inbuf. I'm not quite sure which implementation to that, though. The BSDs?\r\n\r\nA different option might be to define ICONV_CONST to empty (or const?) when undefined, in system.h or something. Depending on how prevelant each option is, that'll at least give us some fallback? But maybe that's not as great as manually making sure it's defined to the *correct* value for each platform... Dunno.\r\n\r\nIn either case, I commited your fix. Thanks! :)"}}