summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2015-12-15 00:12:57 +0000
committerPeter Powell <petpow@saberuk.com>2015-12-31 02:40:36 +0000
commitdd6688b9875bef4c3ce5e66fd19283ac931b72ea (patch)
tree8ef774f4e50e04a72994e1c737ca1dced14bb085
parent63f865dcacf459f65b75a4269288b3090b14f956 (diff)
Remove repeated expressions from CMake end*() and else() calls.
-rw-r--r--CMakeLists.txt104
-rw-r--r--cmake/Anope.cmake40
-rw-r--r--cmake/FindGettext.cmake12
-rw-r--r--docs/CMakeLists.txt4
-rw-r--r--include/CMakeLists.txt2
-rw-r--r--language/CMakeLists.txt6
-rw-r--r--modules/CMakeLists.txt62
-rw-r--r--modules/third/language/CMakeLists.txt6
-rw-r--r--src/CMakeLists.txt28
-rw-r--r--src/tools/CMakeLists.txt6
10 files changed, 135 insertions, 135 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index be2b38261..6f9297f88 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,10 +4,10 @@ cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
cmake_policy(SET CMP0003 NEW)
if(POLICY CMP0026)
cmake_policy(SET CMP0026 OLD)
-endif(POLICY CMP0026)
+endif()
if(POLICY CMP0007)
cmake_policy(SET CMP0007 OLD)
-endif(POLICY CMP0007)
+endif()
# Set the project as C++ primarily, but have C enabled for the checks required later
project(Anope CXX)
@@ -28,10 +28,10 @@ set(ENV{LC_ALL} C)
if(NOT MSVC)
if(CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
- else(CMAKE_BUILD_TYPE)
+ else()
set(CMAKE_BUILD_TYPE DEBUG CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
- endif(CMAKE_BUILD_TYPE)
-endif(NOT MSVC)
+ endif()
+endif()
# Include the checking functions used later in this CMakeLists.txt
include(CheckFunctionExists)
@@ -44,19 +44,19 @@ if(NOT MSVC)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(NOT COMPILER_SUPPORTS_CXX11)
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a newer compiler.")
- endif(NOT COMPILER_SUPPORTS_CXX11)
+ endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-endif(NOT MSVC)
+endif()
# If extra include directories were specified, tell cmake about them.
if(EXTRA_INCLUDE)
include_directories(${EXTRA_INCLUDE})
-endif(EXTRA_INCLUDE)
+endif()
# If extra library directories were specified, tell cmake about them.
if(EXTRA_LIBS)
link_directories(${EXTRA_LIBS})
-endif(EXTRA_LIBS)
+endif()
# Find gettext
find_package(Gettext)
@@ -71,7 +71,7 @@ if(WIN32)
add_definitions(-D_WIN32)
# And include the windows specific folder for our anope_windows.h
include_directories(${Anope_SOURCE_DIR}/src/win32)
-endif(WIN32)
+endif()
# If using Visual Studio, set the C++ flags accordingly
if(MSVC)
@@ -83,7 +83,7 @@ if(MSVC)
set(CXXFLAGS "${CXXFLAGS} /W4 /wd4100 /wd4127 /wd4250 /wd4251 /wd4355 /wd4706 /wd4800 /wd4996 /EHs")
add_definitions(-DMSVCPP -D_CRT_SECURE_NO_WARNINGS)
# Otherwise, we're not using Visual Studio
-else(MSVC)
+else()
# Set the compile flags to have all warnings on (including shadowed variables)
set(CXXFLAGS "${CXXFLAGS} -Wall -Wshadow")
# If on a *nix system, also set the compile flags to remove GNU extensions (favor ISO C++) as well as reject non-ISO C++ code, also remove all leading underscores in exported symbols (only on GNU compiler)
@@ -91,18 +91,18 @@ else(MSVC)
set(CXXFLAGS "${CXXFLAGS} -ansi -pedantic ${CMAKE_CXX_FLAGS}")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CXXFLAGS "${CXXFLAGS} -Wno-long-long -fno-leading-underscore")
- endif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
- endif(UNIX)
-endif(MSVC)
+ endif()
+ endif()
+endif()
# If CMake has found that the given system requires a special library for dl* calls, include it with the linker flags
if(CMAKE_DL_LIBS)
list(APPEND LINK_LIBS ${CMAKE_DL_LIBS})
-endif(CMAKE_DL_LIBS)
+endif()
if(NOT PROGRAM_NAME)
set(PROGRAM_NAME anope)
-endif(NOT PROGRAM_NAME)
+endif()
# If we are not using Visual Studio, we'll run the following checks
if(NOT MSVC)
@@ -111,7 +111,7 @@ if(NOT MSVC)
# If the flag was accepted, add it to the list of flags
if(HAVE_PIPE_FLAG)
set(CXXFLAGS "${CXXFLAGS} -pipe")
- endif(HAVE_PIPE_FLAG)
+ endif()
# The following are additional library checks, they are not required for Windows
if(NOT WIN32)
@@ -119,37 +119,37 @@ if(NOT MSVC)
check_library_exists(socket socket "" HAVE_SOCKET_LIB)
if(HAVE_SOCKET_LIB)
list(APPEND LINK_LIBS socket)
- endif(HAVE_SOCKET_LIB)
+ endif()
# Check if inet_addr is within the nsl library (if the library exists), and add it to the linker flags if needed
check_library_exists(nsl inet_addr "" HAVE_NSL_LIB)
if(HAVE_NSL_LIB)
list(APPEND LINK_LIBS nsl)
- endif(HAVE_NSL_LIB)
+ endif()
# Check if pthread_create is within the pthread library (if the library exists), and add it to the linker flags if needed
check_library_exists(pthread pthread_create "" HAVE_PTHREAD)
if(HAVE_PTHREAD)
if(NOT APPLE)
set(LDFLAGS "${LDFLAGS} -pthread")
- endif(NOT APPLE)
- else(HAVE_PTHREAD)
+ endif()
+ else()
message(FATAL_ERROR "The pthread library is required to build Anope")
- endif(HAVE_PTHREAD)
- endif(NOT WIN32)
-endif(NOT MSVC)
+ endif()
+ endif()
+endif()
# If DEFUMASK wasn't passed to CMake, set a default depending on if RUNGROUP was passed in or not
if(NOT DEFUMASK)
if(RUNGROUP)
set(DEFUMASK "007")
- else(RUNGROUP)
+ else()
set(DEFUMASK "077")
- endif(RUNGROUP)
-endif(NOT DEFUMASK)
+ endif()
+endif()
# Set the DEBUG_BUILD for sysconf.h
if(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
set(DEBUG_BUILD TRUE)
-endif(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
+endif()
# Check for the existance of the following functions
check_function_exists(umask HAVE_UMASK)
@@ -160,11 +160,11 @@ check_function_exists(kqueue HAVE_KQUEUE)
# Strip the leading and trailing spaces from the compile flags
if(CXXFLAGS)
string(STRIP ${CXXFLAGS} CXXFLAGS)
-endif(CXXFLAGS)
+endif()
# Strip the leading and trailing spaces from the linker flags
if(LDFLAGS)
string(STRIP ${LDFLAGS} LDFLAGS)
-endif(LDFLAGS)
+endif()
# Search for the following programs
find_program(CHGRP chgrp)
@@ -173,32 +173,32 @@ find_program(CHMOD chmod)
# If a INSTDIR was passed in to CMake, use it as the install prefix, otherwise set the default install prefix to the services directory under the user's home directory
if(INSTDIR)
set(CMAKE_INSTALL_PREFIX "${INSTDIR}")
-elseif(NOT CMAKE_INSTALL_PREFIX)
+elseif()
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/anope")
-endif(INSTDIR)
+endif()
# Set default paths for various directories if not already defined
if(NOT BIN_DIR)
set(BIN_DIR "bin")
-endif(NOT BIN_DIR)
+endif()
if(NOT DB_DIR)
set(DB_DIR "data")
-endif(NOT DB_DIR)
+endif()
if(NOT DOC_DIR)
set(DOC_DIR "doc")
-endif(NOT DOC_DIR)
+endif()
if(NOT CONF_DIR)
set(CONF_DIR "conf")
-endif(NOT CONF_DIR)
+endif()
if(NOT LIB_DIR)
set(LIB_DIR "lib")
-endif(NOT LIB_DIR)
+endif()
if(NOT LOCALE_DIR)
set(LOCALE_DIR "locale")
-endif(NOT LOCALE_DIR)
+endif()
if(NOT LOGS_DIR)
set(LOGS_DIR "logs")
-endif(NOT LOGS_DIR)
+endif()
# Version number processing
# Find all lines in src/version.sh that start with VERSION_
@@ -212,8 +212,8 @@ foreach(VERSION_STR ${VERSIONS})
if(${VERSION_LEN} GREATER 1)
list(GET VERSION_OUT 1 VERSION_DATA)
set(VERSION_${VERSION_TYPE} ${VERSION_DATA})
- endif(${VERSION_LEN} GREATER 1)
-endforeach(VERSION_STR ${VERSIONS})
+ endif()
+endforeach()
# Default build version to 0
set(VERSION_BUILD 0)
@@ -231,8 +231,8 @@ if(EXISTS "${Anope_SOURCE_DIR}/include/version.h")
string(SUBSTRING ${VERSION_STR} 22 ${VERSION_NUM_LEN} VERSION)
# Set VERSION_BUILD correctly
set(VERSION_BUILD ${VERSION})
- endforeach(VERSION_STR ${VERSIONS})
-endif(EXISTS "${Anope_SOURCE_DIR}/include/version.h")
+ endforeach()
+endif()
# Set the version variables based on what was found above
set(VERSION_COMMA "${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_BUILD}")
@@ -245,7 +245,7 @@ set(VERSION_FULL_NOBUILD "${VERSION_DOTTED_NOBUILD}${VERSION_EXTRA}")
if(WIN32)
# Generate the win32.rc file using the above variables
configure_file(${Anope_SOURCE_DIR}/src/win32/win32.rc.cmake ${Anope_BINARY_DIR}/src/win32/win32.rc)
-endif(WIN32)
+endif()
# Add the initial files to ignore which will be ignored regardless of if you are building in-source or out-of-source
add_to_cpack_ignored_files(".git\;config.cache\;CMakeFiles\;sysconf.h$\;build" TRUE)
@@ -260,8 +260,8 @@ if(${Anope_SOURCE_DIR} STREQUAL ${Anope_BINARY_DIR})
# If using Visual Studio, add these files as well
if(MSVC)
add_to_cpack_ignored_files(".vcproj$\;.sln$\;.ncb$\;.suo$\;.dir$\;.ilk$\;.exp$\;.pdb$\;.lib$\;/debug$;/release$;/relwithdebinfo$;/minsizerel$" TRUE)
- endif(MSVC)
-endif(${Anope_SOURCE_DIR} STREQUAL ${Anope_BINARY_DIR})
+ endif()
+endif()
# Go into the following directories and run their CMakeLists.txt as well
add_subdirectory(data)
@@ -280,13 +280,13 @@ install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${DB_D
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${LOGS_DIR}\")")
if(WIN32)
install(CODE "file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${DB_DIR}/runtime\")")
-endif(WIN32)
+endif()
# On non-Windows platforms, if RUNGROUP is set, change the permissions of the below directories, as well as the group of the data directory
if(NOT WIN32 AND RUNGROUP)
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/\${DB_DIR}/backups\")")
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/\${LOGS_DIR}\")")
install(CODE "execute_process(COMMAND ${CHGRP} -R ${RUNGROUP} \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}\")")
-endif(NOT WIN32 AND RUNGROUP)
+endif()
# On Windows platforms, install extra files
if(WIN32)
install(FILES ${Anope_SOURCE_DIR}/src/win32/anope.bat
@@ -296,7 +296,7 @@ if(WIN32)
# Package any DLLs in src/win/
file(GLOB EXTRA_DLLS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${Anope_SOURCE_DIR}/src/win32/*.dll")
install(FILES ${EXTRA_DLLS} DESTINATION ${BIN_DIR})
-endif(WIN32)
+endif()
install(CODE "file(REMOVE_RECURSE \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/modules\")")
@@ -317,7 +317,7 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
# By default, do not warn when built on machines using only VS Express:
IF(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
- ENDIF(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
+ ENDIF()
# Also for Windows, include installing the MSVCRT library
include(InstallRequiredSystemLibraries)
set(CPACK_GENERATOR "NSIS")
@@ -337,10 +337,10 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
set(CPACK_NSIS_INSTALLED_ICON_NAME "${SERVICES_BINARY}")
set(CPACK_NSIS_URL_INFO_ABOUT "http://www.anope.org/")
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
- endif(WIN32)
+ endif()
set(CPACK_SOURCE_PACKAGE_FILE_NAME "anope-${VERSION_FULL_NOBUILD}-source")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES "$ENV{CPACK_IGNORED_FILES}")
set(CPACK_MONOLITHIC_INSTALL TRUE)
include(CPack)
-endif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
+endif()
diff --git a/cmake/Anope.cmake b/cmake/Anope.cmake
index 48a57d213..7e125692e 100644
--- a/cmake/Anope.cmake
+++ b/cmake/Anope.cmake
@@ -16,9 +16,9 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
# Check to see if there are any lines matching: /* RequiredLibraries: [something] */
if(WIN32)
file(STRINGS ${SRC} REQUIRED_LIBRARIES REGEX "/\\*[ \t]*RequiredWindowsLibraries:[ \t]*.*[ \t]*\\*/")
- else(WIN32)
+ else()
file(STRINGS ${SRC} REQUIRED_LIBRARIES REGEX "/\\*[ \t]*RequiredLibraries:[ \t]*.*[ \t]*\\*/")
- endif(WIN32)
+ endif()
# Iterate through those lines
foreach(REQUIRED_LIBRARY ${REQUIRED_LIBRARIES})
# Strip off the /* RequiredLibraries: and */ from the line
@@ -36,36 +36,36 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
if(MSVC)
# For Visual Studio, instead of editing the linker flags, we'll add the library to a separate list of extra dependencies
list(APPEND EXTRA_DEPENDENCIES "${FOUND_${LIBRARY}_LIBRARY}")
- else(MSVC)
+ else()
# For all others, add the library paths and libraries
list(APPEND LIBRARY_PATHS "${LIBRARY_PATH}")
list(APPEND LIBRARIES "${LIBRARY}")
- endif(MSVC)
- else(FOUND_${LIBRARY}_LIBRARY)
+ endif()
+ else()
# In the case of the library not being found, we fatally error so CMake stops trying to generate
message(FATAL_ERROR "${SRC} needs library ${LIBRARY} but we were unable to locate that library! Check that the library is within the search path of your OS.")
- endif(FOUND_${LIBRARY}_LIBRARY)
- endforeach(LIBRARY)
- endforeach(REQUIRED_LIBRARY)
+ endif()
+ endforeach()
+ endforeach()
# Remove duplicates from the library paths
if(LIBRARY_PATHS)
list(REMOVE_DUPLICATES LIBRARY_PATHS)
- endif(LIBRARY_PATHS)
+ endif()
# Remove diplicates from the libraries
if(LIBRARIES)
list(REMOVE_DUPLICATES LIBRARIES)
- endif(LIBRARIES)
+ endif()
# Iterate through library paths and add them to the linker flags
foreach(LIBRARY_PATH ${LIBRARY_PATHS})
set(THIS_LDFLAGS "${THIS_LDFLAGS} -L${LIBRARY_PATH}")
- endforeach(LIBRARY_PATH)
+ endforeach()
# Iterate through libraries and add them to the linker flags
foreach(LIBRARY ${LIBRARIES})
list(APPEND EXTRA_DEPENDENCIES "${LIBRARY}")
- endforeach(LIBRARY)
+ endforeach()
set(${SRC_LDFLAGS} "${THIS_LDFLAGS}")
set(${EXTRA_DEPENDS} "${EXTRA_DEPENDENCIES}")
-endmacro(calculate_libraries)
+endmacro()
###############################################################################
# add_to_cpack_ignored_files(<item> [TRUE])
@@ -80,15 +80,15 @@ macro(add_to_cpack_ignored_files ITEM)
# If we have 2+ arguments, assume that the second one was something like TRUE (doesn't matter really) and convert periods so they will be \\. for CPack
if(${ARGC} GREATER 1)
string(REPLACE "." "\\\\." REAL_ITEM ${REAL_ITEM})
- endif(${ARGC} GREATER 1)
+ endif()
# If the environment variable is already defined, just tack the item to the end
if(DEFINED ENV{CPACK_IGNORED_FILES})
set(ENV{CPACK_IGNORED_FILES} "$ENV{CPACK_IGNORED_FILES};${REAL_ITEM}")
# Otherwise set the environment variable to the item
- else(DEFINED ENV{CPACK_IGNORED_FILES})
+ else()
set(ENV{CPACK_IGNORED_FILES} "${REAL_ITEM}")
- endif(DEFINED ENV{CPACK_IGNORED_FILES})
-endmacro(add_to_cpack_ignored_files)
+ endif()
+endmacro()
macro(calculate_dependencies SRC)
file(STRINGS ${SRC} REQUIRED_LIBRARIES REGEX "/\\*[ \t]*Dependencies:[ \t]*.*[ \t]*\\*/")
@@ -102,7 +102,7 @@ macro(calculate_dependencies SRC)
get_filename_component(TARGNAME ${SRC} NAME_WE)
target_link_libraries(${TARGNAME} ${LIBRARY})
add_dependencies(${TARGNAME} ${LIBRARY})
- endforeach(LIBRARY)
- endforeach(REQUIRED_LIBRARY)
-endmacro(calculate_dependencies)
+ endforeach()
+ endforeach()
+endmacro()
diff --git a/cmake/FindGettext.cmake b/cmake/FindGettext.cmake
index 975294d21..b0f4f9486 100644
--- a/cmake/FindGettext.cmake
+++ b/cmake/FindGettext.cmake
@@ -7,20 +7,20 @@ if(NOT WIN32)
set(GETTEXT_FOUND TRUE)
if(GETTEXT_LIBRARY)
set(GETTEXT_LIBRARIES ${GETTEXT_LIBRARY})
- endif(GETTEXT_LIBRARY)
- endif(GETTEXT_INCLUDE AND GETTEXT_MSGFMT)
-else(NOT WIN32)
+ endif()
+ endif()
+else()
find_path(GETTEXT_INCLUDE libintl.h ${DEFAULT_INCLUDE_DIRS} ${WSDK_PATH}/include $ENV{VCINSTALLDIR}/include gettext/include ${EXTRA_INCLUDE})
find_library(GETTEXT_LIBRARY libintl PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib gettext/lib ${EXTRA_LIBS})
find_program(GETTEXT_MSGFMT msgfmt PATHS ${DEFAULT_INCLUDE_DIRS} ${WSDK_PATH}/bin $ENV{VCINSTALLDIR}/bin gettext/bin ${EXTRA_INCLUDE})
if(GETTEXT_INCLUDE AND GETTEXT_LIBRARY AND GETTEXT_MSGFMT)
set(GETTEXT_FOUND TRUE)
set(GETTEXT_LIBRARIES ${GETTEXT_LIBRARY})
- endif(GETTEXT_INCLUDE AND GETTEXT_LIBRARY AND GETTEXT_MSGFMT)
-endif(NOT WIN32)
+ endif()
+endif()
# If we found everything we need set variables correctly for lang/CMakeLists.txt to use
if(GETTEXT_FOUND)
include_directories("${GETTEXT_INCLUDE}")
set(GETTEXT_MSGFMT_EXECUTABLE ${GETTEXT_MSGFMT})
-endif(GETTEXT_FOUND)
+endif()
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index 082b1da0e..fd93e81c0 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -6,10 +6,10 @@ if(WIN32)
if(IN_SOURCE)
# Add README.txt to list of files for CPack to ignore
add_to_cpack_ignored_files("README.txt$" TRUE)
- endif(IN_SOURCE)
+ endif()
set(DOCS Changes Changes.conf DEFCON FAQ INSTALL LANGUAGE MODULES NEWS ${CMAKE_CURRENT_BINARY_DIR}/README.txt WIN32.txt)
install(FILES ${DOCS}
DESTINATION ${DOC_DIR}
)
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/README.txt")
-endif(WIN32)
+endif()
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 72bfdfba1..f4ed6a0a4 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -16,7 +16,7 @@ add_to_cpack_ignored_files("${version_BINARY}$" TRUE)
if(NOT WIN32)
add_to_cpack_ignored_files("version.h$" TRUE)
add_to_cpack_ignored_files("build.h$" TRUE)
-endif(NOT WIN32)
+endif()
# Add a custom target to the above file
add_custom_target(headers DEPENDS version ${CMAKE_CURRENT_BINARY_DIR}/version_build)
diff --git a/language/CMakeLists.txt b/language/CMakeLists.txt
index ff5ae2b8f..a5135a273 100644
--- a/language/CMakeLists.txt
+++ b/language/CMakeLists.txt
@@ -26,12 +26,12 @@ if(GETTEXT_FOUND)
# Add to cpack ignored files if not on Windows.
if(NOT WIN32)
add_to_cpack_ignored_files("${LANG_MO}")
- endif(NOT WIN32)
+ endif()
# Install the new language file
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG_MO} DESTINATION ${LOCALE_DIR}/${LANG_LANG}/LC_MESSAGES RENAME ${LANG_DOMAIN}.mo PERMISSIONS ${PERMS})
- endforeach(LANG_PO)
+ endforeach()
# Generate languages, depends on the mo files
add_custom_target(language DEPENDS ${LANG_SRCS_MO})
-endif(GETTEXT_FOUND)
+endif()
diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt
index 68a2a89b0..a313e2185 100644
--- a/modules/CMakeLists.txt
+++ b/modules/CMakeLists.txt
@@ -1,17 +1,17 @@
# If using Windows, add the MODULE_COMPILE define
if(WIN32)
add_definitions(-DMODULE_COMPILE)
-endif(WIN32)
+endif()
macro(build_modules SRC)
if(NOT ${SRC} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} AND EXISTS "${SRC}/CMakeLists.txt")
add_subdirectory("${SRC}")
- else(NOT ${SRC} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} AND EXISTS "${SRC}/CMakeLists.txt")
+ else()
file(GLOB MODULES_SRCS "${SRC}/*")
foreach(MODULE_SRC ${MODULES_SRCS})
if(IS_DIRECTORY "${MODULE_SRC}")
build_modules("${MODULE_SRC}")
- else(IS_DIRECTORY "${MODULE_SRC}")
+ else()
string(REGEX MATCH "\\.cpp$" CPP ${MODULE_SRC})
if(CPP)
set_source_files_properties(${MODULE_SRC} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
@@ -23,9 +23,9 @@ macro(build_modules SRC)
file(RELATIVE_PATH DEST "${Anope_SOURCE_DIR}/modules" ${SRC})
if(DEST)
set(TARG "module_${DEST}.${SO}")
- else(DEST)
+ else()
set(TARG "module_${SO}")
- endif(DEST)
+ endif()
# Reset linker flags
set(TEMP_LDFLAGS)
@@ -36,40 +36,40 @@ macro(build_modules SRC)
# For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators
if(MSVC)
set(WIN32_MEMORY win32_memory)
- else(MSVC)
+ else()
set(WIN32_MEMORY)
- endif(MSVC)
+ endif()
# Generate the module and set its linker flags, also set it to depend on the main Anope executable to be built beforehand
add_library(${TARG} MODULE ${MODULE_SRC})
# Windows requires this because it's weird
if(WIN32)
set(WIN32_NO_LIBS "/nodefaultlib:\"libcmt.lib\" /OPT:NOREF")
- else(WIN32)
+ else()
set(WIN32_NO_LIBS)
- endif(WIN32)
+ endif()
set_target_properties(${TARG} PROPERTIES LINKER_LANGUAGE CXX PREFIX "" LINK_FLAGS "${TEMP_LDFLAGS} ${WIN32_NO_LIBS}" INSTALL_RPATH_USE_LINK_PATH ON BUILD_WITH_INSTALL_RPATH ON OUTPUT_NAME "${SO}")
add_dependencies(${TARG} ${PROGRAM_NAME})
if(GETTEXT_FOUND)
add_dependencies(${TARG} module_language)
- endif(GETTEXT_FOUND)
+ endif()
target_link_libraries(${TARG} ${TEMP_DEPENDENCIES})
# For Windows only, have the module link to the export library of Anope as well as wsock32 and Ws2_32 libraries (most of the modules probably don't need this, but this is to be on the safe side), also set its version
if(WIN32)
target_link_libraries(${TARG} ${PROGRAM_NAME} wsock32 Ws2_32 ${WIN32_MEMORY})
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
- else(WIN32)
+ else()
if(APPLE)
target_link_libraries(${TARG} ${PROGRAM_NAME})
- endif(APPLE)
- endif(WIN32)
+ endif()
+ endif()
calculate_dependencies(${MODULE_SRC})
# Set the module to be installed to the module directory under the data directory
install(TARGETS ${TARG} DESTINATION ${LIB_DIR}/modules/${DEST})
- endif(CPP)
- endif(IS_DIRECTORY "${MODULE_SRC}")
- endforeach(MODULE_SRC ${MODULES_SRCS})
- endif(NOT ${SRC} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} AND EXISTS "${SRC}/CMakeLists.txt")
-endmacro(build_modules)
+ endif()
+ endif()
+ endforeach()
+ endif()
+endmacro()
macro(build_subdir)
file(GLOB_RECURSE MODULES_SUBDIR_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
@@ -80,9 +80,9 @@ macro(build_subdir)
GET_FILENAME_COMPONENT(FOLDER_NAME ${DEST} NAME)
if(DIR_NAME)
set(SO "${DIR_NAME}.${FOLDER_NAME}")
- else(DIR_NAME)
+ else()
set(SO "${FOLDER_NAME}")
- endif(DIR_NAME)
+ endif()
# Set all the files to use C++ as well as set their compile flags (use the module-specific compile flags, though)
set_source_files_properties(${MODULES_SUBDIR_SRCS} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
@@ -100,25 +100,25 @@ macro(build_subdir)
# Append this source file's linker flags to the subdirectoy's linker flags, if there are any to append
if(TEMP_DEPENDENCIES)
append_to_list(SUBDIR_EXTRA_DEPENDS ${TEMP_DEPDENCIES})
- endif(TEMP_DEPENDENCIES)
- endforeach(SRC ${MODULES_SUBDIR_SRCS})
+ endif()
+ endforeach()
# Remove duplicates from the linker flags
if(SUBDIR_LDFLAGS)
list(REMOVE_DUPLICATES SUBDIR_LDFLAGS)
- endif(SUBDIR_LDFLAGS)
+ endif()
# Remove duplicates from the extra dependencies
if(SUBDIR_EXTRA_DEPENDS)
list(REMOVE_DUPLICATES SUBDIR_EXTRA_DEPENDS)
- endif(SUBDIR_EXTRA_DEPENDS)
+ endif()
# For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators
if(MSVC)
set(WIN32_MEMORY win32_memory)
- else(MSVC)
+ else()
set(WIN32_MEMORY)
- endif(MSVC)
+ endif()
# Generate the module and set its linker flags, also set it to depend on the main Anope executable to be built beforehand
add_library(${SO} MODULE ${MODULES_SUBDIR_SRCS})
@@ -126,20 +126,20 @@ macro(build_subdir)
add_dependencies(${SO} ${PROGRAM_NAME})
if(GETTEXT_FOUND)
add_dependencies(${SO} module_language)
- endif(GETTEXT_FOUND)
+ endif()
target_link_libraries(${SO} ${SUBDIR_EXTRA_DEPENDS})
# For Windows only, have the module link to the export library of Anope as well as wsock32 and Ws2_32 libraries (most of the modules probably don't need this, but this is to be on the safe side), also set its version
if(WIN32)
target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 Ws2_32 ${WIN32_MEMORY})
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
- else(WIN32)
+ else()
if(APPLE)
target_link_libraries(${SO} ${PROGRAM_NAME})
- endif(APPLE)
- endif(WIN32)
+ endif()
+ endif()
install(TARGETS ${SO} DESTINATION ${LIB_DIR}/modules/${DIR_NAME})
-endmacro(build_subdir)
+endmacro()
build_modules(${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/modules/third/language/CMakeLists.txt b/modules/third/language/CMakeLists.txt
index c46544836..835b4ee4f 100644
--- a/modules/third/language/CMakeLists.txt
+++ b/modules/third/language/CMakeLists.txt
@@ -26,13 +26,13 @@ if(GETTEXT_FOUND)
# Add to cpack ignored files if not on Windows.
if(NOT WIN32)
add_to_cpack_ignored_files("${LANG_MO}")
- endif(NOT WIN32)
+ endif()
# Install the new language file
install(CODE "FILE(MAKE_DIRECTORY ${LOCALE_DIR}/${LANG_LANG}/LC_MESSAGES/)")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG_MO} DESTINATION ${LOCALE_DIR}/${LANG_LANG}/LC_MESSAGES RENAME ${LANG_DOMAIN}.mo PERMISSIONS ${PERMS})
- endforeach(LANG_PO)
+ endforeach()
# Generate languages, depends on the mo files
add_custom_target(module_language DEPENDS ${LANG_SRCS_MO})
-endif(GETTEXT_FOUND)
+endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b32c1d9c0..ba2eff6c9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -8,21 +8,21 @@ if(WIN32)
list(APPEND SRC_SRCS win32/dl/dl.cpp)
list(APPEND SRC_SRCS win32/pipe/pipe.cpp)
list(APPEND SRC_SRCS win32/sigaction/sigaction.cpp)
-endif(WIN32)
+endif()
if(HAVE_EPOLL)
list(APPEND SRC_SRCS socketengines/socketengine_epoll.cpp)
-else(HAVE_EPOLL)
+else()
if(HAVE_KQUEUE)
list(APPEND SRC_SRCS socketengines/socketengine_kqueue.cpp)
- else(HAVE_KQUEUE)
+ else()
if(HAVE_POLL)
list(APPEND SRC_SRCS socketengines/socketengine_poll.cpp)
- else(HAVE_POLL)
+ else()
list(APPEND SRC_SRCS socketengines/socketengine_select.cpp)
- endif(HAVE_POLL)
- endif(HAVE_KQUEUE)
-endif(HAVE_EPOLL)
+ endif()
+ endif()
+endif()
list(SORT SRC_SRCS)
@@ -36,7 +36,7 @@ if(WIN32)
# Add the resource file to the list of sources
list(APPEND SRC_SRCS ${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc COMPILE_FLAGS "/i\"${Anope_SOURCE_DIR}/include\"")
-endif(WIN32)
+endif()
# If compiling with Visual Studio, create a static library out of win32/win32_memory.cpp to be included with everything else, needed to override its override of new/delete operators
if(MSVC)
@@ -44,9 +44,9 @@ if(MSVC)
add_library(win32_memory STATIC win32/win32_memory.cpp)
set(WIN32_MEMORY win32_memory)
set(EXTRA_LDFLAGS "/OPT:NOREF") # https://sourceware.org/bugzilla/show_bug.cgi?id=12633
-else(MSVC)
+else()
set(WIN32_MEMORY)
-endif(MSVC)
+endif()
# 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
add_executable(${PROGRAM_NAME} ${SRC_SRCS})
@@ -55,15 +55,15 @@ set_target_properties(${PROGRAM_NAME} PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS
if(WIN32)
target_link_libraries(${PROGRAM_NAME} wsock32 Ws2_32 ${LINK_LIBS} ${GETTEXT_LIBRARIES} ${WIN32_MEMORY})
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
-else(WIN32)
+else()
target_link_libraries(${PROGRAM_NAME} ${LINK_LIBS} ${GETTEXT_LIBRARIES})
-endif(WIN32)
+endif()
# Building the Anope executable requires the version.h header to be generated
add_dependencies(${PROGRAM_NAME} headers)
# Also require the language files if we have gettext
if(GETTEXT_FOUND)
add_dependencies(${PROGRAM_NAME} language)
-endif(GETTEXT_FOUND)
+endif()
# Get the filename of the Anope executable as it is in on this system
get_target_property(SERVICES_BINARY ${PROGRAM_NAME} LOCATION)
@@ -77,7 +77,7 @@ configure_file(${Anope_SOURCE_DIR}/include/sysconf.h.cmake ${Anope_BINARY_DIR}/i
# Go into the following directories and run their CMakeLists.txt as well
if(NOT DISABLE_TOOLS)
add_subdirectory(tools)
-endif(NOT DISABLE_TOOLS)
+endif()
# Set Anope to be installed to the bin directory
install(TARGETS ${PROGRAM_NAME}
diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt
index d970d93b0..4d64f6fd9 100644
--- a/src/tools/CMakeLists.txt
+++ b/src/tools/CMakeLists.txt
@@ -21,7 +21,7 @@ foreach(SRC ${TOOLS_SRCS})
get_target_property(EXE_BINARY ${EXE} LOCATION)
get_filename_component(EXE_BINARY ${EXE_BINARY} NAME)
add_to_cpack_ignored_files("${EXE_BINARY}$" TRUE)
-endforeach(SRC)
+endforeach()
# If not on Windows, generate anoperc and install it along with mydbgen
if(NOT WIN32)
@@ -32,9 +32,9 @@ if(NOT WIN32)
install (PROGRAMS geoipupdate.sh
DESTINATION ${BIN_DIR}
)
-endif(NOT WIN32)
+endif()
# 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 \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin\")")
-endif(NOT WIN32 AND RUNGROUP)
+endif()