summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/CMakeLists.txt62
-rw-r--r--modules/third/language/CMakeLists.txt6
2 files changed, 34 insertions, 34 deletions
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()