summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2008-12-23 07:38:22 +0000
committercyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2008-12-23 07:38:22 +0000
commite802b6dfe8ef0105389b69e17e7faa2e4c92d756 (patch)
tree7556cf902a0f943cb4bbc3b47b89fb13797ad4e1 /src
parent40ec6f0854c2210e670199f701636d9d78ffa6c0 (diff)
Some more Windows fixes, both in CMake and in the code itself. (I don't like the const casting for the latter, but it's only until we get rid of use of strchr)
Added CPack setup to automate generation of source package for *nix and NSIS installer for Windows. Some other minor CMake fixes. Converted docs/README and docs/WIN32.txt from Unix linefeeds to DOS linefeeds so they show up right in Notepad under Windows. Added small fix for Visual Studio 2008, CMake doesn't detect the Express version correctly and it must be explicitly defined. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1861 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt10
-rw-r--r--src/base64.c2
-rw-r--r--src/bin/CMakeLists.txt8
-rw-r--r--src/channels.c6
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/messages.c2
-rw-r--r--src/modules/CMakeLists.txt2
-rw-r--r--src/process.c12
-rw-r--r--src/protocol/CMakeLists.txt2
-rw-r--r--src/tools/CMakeLists.txt10
-rw-r--r--src/tools/db-convert.c2
-rw-r--r--src/users.c4
12 files changed, 40 insertions, 22 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index eca0c782b..2a8c01d0e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -37,6 +37,10 @@ if(WIN32)
else(MINGW)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/win32.rc COMPILE_FLAGS "/i\"${Anope_SOURCE_DIR}/include\"")
endif(MINGW)
+ if(IN_SOURCE)
+ # Add the resource file to the list of files for CPack to ignore
+ add_to_cpack_ignored_files("win32.rc$" TRUE)
+ endif(IN_SOURCE)
endif(WIN32)
# Generate the Anope executable and set it's linker flags, also set it to export it's symbols even though it's not a module
@@ -54,6 +58,10 @@ add_dependencies(${PROGRAM_NAME} language headers)
get_target_property(SERVICES_BINARY ${PROGRAM_NAME} LOCATION)
get_filename_component(SERVICES_BINARY ${SERVICES_BINARY} NAME)
set(SERVICES_BIN "${SERVICES_BINARY}")
+if(IN_SOURCE)
+ # Add the Anope executable to the list of files for CPack to ignore
+ add_to_cpack_ignored_files("${SERVICES_BINARY}$" TRUE)
+endif(IN_SOURCE)
# Generate sysconf.h from the earlier configuration
configure_file(${Anope_SOURCE_DIR}/include/sysconf.h.cmake ${Anope_BINARY_DIR}/include/sysconf.h)
@@ -67,5 +75,5 @@ add_subdirectory(tools)
# Set Anope to be installed to the bin directory
install(TARGETS ${PROGRAM_NAME}
- DESTINATION "${INSTDIR}"
+ DESTINATION .
)
diff --git a/src/base64.c b/src/base64.c
index 144c51bec..d32f6ccda 100644
--- a/src/base64.c
+++ b/src/base64.c
@@ -177,7 +177,7 @@ int b64_decode(const char *src, char *target, size_t targsize)
if (ch == Pad64)
break;
- pos = strchr(Base64, ch);
+ pos = const_cast<char *>(strchr(Base64, ch));
if (pos == 0) /* A non-base64 character. */
return (-1);
diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt
index 99a7e5136..34044ddf9 100644
--- a/src/bin/CMakeLists.txt
+++ b/src/bin/CMakeLists.txt
@@ -2,9 +2,13 @@
if(NOT WIN32)
configure_file(${Anope_SOURCE_DIR}/src/bin/anoperc.cmake ${Anope_BINARY_DIR}/src/bin/anoperc)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/anoperc
- DESTINATION "${INSTDIR}"
+ DESTINATION .
)
+ if(IN_SOURCE)
+ # Add anoperc to list of files for CPack to ignore
+ add_to_cpack_ignored_files("anoperc$")
+ endif(IN_SOURCE)
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mydbgen
- DESTINATION "${DATADIR}"
+ DESTINATION data
)
endif(NOT WIN32)
diff --git a/src/channels.c b/src/channels.c
index f901967b2..05891674c 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -813,7 +813,7 @@ void do_sjoin(const char *source, int ac, const char **av)
s = av[ac - 1]; /* Users are always the last element */
while (*s) {
- end = strchr(s, ' ');
+ end = const_cast<char *>(strchr(s, ' '));
if (end)
*end = 0;
@@ -930,7 +930,7 @@ void do_sjoin(const char *source, int ac, const char **av)
s = av[2]; /* Users are always the last element */
while (*s) {
- end = strchr(s, ' ');
+ end = const_cast<char *>(strchr(s, ' '));
if (end)
*end = 0;
@@ -1005,7 +1005,7 @@ void do_sjoin(const char *source, int ac, const char **av)
s = sstrdup(source); /* Users are always the last element */
while (*s) {
- end = strchr(s, ' ');
+ end = const_cast<char *>(strchr(s, ' '));
if (end)
*end = 0;
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 904220c06..7b02ac340 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -31,6 +31,6 @@ foreach(SRC ${CORE_SRCS})
endif(WIN32)
# Set the module to be installed to the module directory under the data directory
install(TARGETS ${SO}
- DESTINATION "${DATADIR}/modules"
+ DESTINATION data/modules
)
endforeach(SRC)
diff --git a/src/messages.c b/src/messages.c
index 1a2445a66..b0e5fe710 100644
--- a/src/messages.c
+++ b/src/messages.c
@@ -148,7 +148,7 @@ int m_privmsg(const char *source, const char *receiver, const char *msg)
/* If a server is specified (nick@server format), make sure it matches
* us, and strip it off. */
- s = strchr(receiver, '@');
+ s = const_cast<char *>(strchr(receiver, '@'));
if (s) {
*s++ = 0;
if (stricmp(s, ServerName) != 0)
diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt
index 5d9c37cae..aa04edaa6 100644
--- a/src/modules/CMakeLists.txt
+++ b/src/modules/CMakeLists.txt
@@ -31,6 +31,6 @@ foreach(SRC ${MODULES_SRCS})
endif(WIN32)
# Set the module to be installed to the module directory under the data directory
install(TARGETS ${SO}
- DESTINATION "${DATADIR}/modules"
+ DESTINATION data/modules
)
endforeach(SRC)
diff --git a/src/process.c b/src/process.c
index cb5bf7bd0..4c61ed192 100644
--- a/src/process.c
+++ b/src/process.c
@@ -46,9 +46,9 @@ void add_ignore(const char *nick, time_t delta)
snprintf(tmp, sizeof(tmp), "*!*@%s", u->host);
mask = sstrdup(tmp);
/* Determine whether we get a nick or a mask. */
- } else if ((host = strchr(nick, '@'))) {
+ } else if ((host = const_cast<char *>(strchr(nick, '@')))) {
/* Check whether we have a nick too.. */
- if ((user = strchr(nick, '!'))) {
+ if ((user = const_cast<char *>(strchr(nick, '!')))) {
/* this should never happen */
if (user > host)
return;
@@ -121,8 +121,8 @@ IgnoreData *get_ignore(const char *nick)
break;
} else {
/* We didn't get a user.. generate a valid mask. */
- if ((host = strchr(nick, '@'))) {
- if ((user = strchr(nick, '!'))) {
+ if ((host = const_cast<char *>(strchr(nick, '@')))) {
+ if ((user = const_cast<char *>(strchr(nick, '!')))) {
/* this should never happen */
if (user > host)
return NULL;
@@ -177,9 +177,9 @@ int delete_ignore(const char *nick)
if ((u = finduser(nick))) {
snprintf(tmp, sizeof(tmp), "*!*@%s", u->host);
/* Determine whether we get a nick or a mask. */
- } else if ((host = strchr(nick, '@'))) {
+ } else if ((host = const_cast<char *>(strchr(nick, '@')))) {
/* Check whether we have a nick too.. */
- if ((user = strchr(nick, '!'))) {
+ if ((user = const_cast<char *>(strchr(nick, '!')))) {
/* this should never happen */
if (user > host)
return 0;
diff --git a/src/protocol/CMakeLists.txt b/src/protocol/CMakeLists.txt
index 50f83409c..6fd48290e 100644
--- a/src/protocol/CMakeLists.txt
+++ b/src/protocol/CMakeLists.txt
@@ -31,6 +31,6 @@ foreach(SRC ${PROTOCOL_SRCS})
endif(WIN32)
# Set the module to be installed to the module directory under the data directory
install(TARGETS ${SO}
- DESTINATION "${DATADIR}/modules"
+ DESTINATION data/modules
)
endforeach(SRC)
diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt
index f995de04f..05c535863 100644
--- a/src/tools/CMakeLists.txt
+++ b/src/tools/CMakeLists.txt
@@ -21,8 +21,14 @@ foreach(SRC ${TOOLS_SRCS})
add_dependencies(${EXE} ${PROGRAM_NAME})
# Set the executable to be installed to the tools directory under the bin directory
install(TARGETS ${EXE}
- DESTINATION "${INSTDIR}/tools"
+ DESTINATION tools
)
+ if(IN_SOURCE)
+ # Add the executable to the list of files for CPack to ignore
+ get_target_property(EXE_BINARY ${EXE} LOCATION)
+ get_filename_component(EXE_BINARY ${EXE_BINARY} NAME)
+ add_to_cpack_ignored_files("${EXE_BINARY}$" TRUE)
+ endif(IN_SOURCE)
endforeach(SRC)
# Only for Windows, set anopesmtp to require the wsock32 library
@@ -32,5 +38,5 @@ endif(WIN32)
# On non-Windows platforms, if RUNGROUP is set, change the permissions of the tools directory
if(NOT WIN32 AND RUNGROUP)
- install(CODE "execute_process(COMMAND ${CHMOD} 2770 \"${INSTDIR}/tools\")")
+ install(CODE "execute_process(COMMAND ${CHMOD} 2770 \"\${CMAKE_INSTALL_PREFIX}/tools\")")
endif(NOT WIN32 AND RUNGROUP)
diff --git a/src/tools/db-convert.c b/src/tools/db-convert.c
index d561c5333..084091142 100644
--- a/src/tools/db-convert.c
+++ b/src/tools/db-convert.c
@@ -1582,7 +1582,7 @@ int b64_decode(const char *src, char *target, size_t targsize)
if (ch == Pad64)
break;
- pos = strchr(Base64, ch);
+ pos = const_cast<char *>(strchr(Base64, ch));
if (pos == 0) /* A non-base64 character. */
return (-1);
diff --git a/src/users.c b/src/users.c
index 3c9dc069e..abe8211ba 100644
--- a/src/users.c
+++ b/src/users.c
@@ -521,10 +521,10 @@ User *do_nick(const char *source, const char *nick, const char *username, const
* Ugly swap routine for Flop's bug :)
**/
if (realname) {
- tmp = strchr(realname, '%');
+ tmp = const_cast<char *>(strchr(realname, '%'));
while (tmp) {
*tmp = '-';
- tmp = strchr(realname, '%');
+ tmp = const_cast<char *>(strchr(realname, '%'));
}
}
logrealname = normalizeBuffer(realname);