diff options
author | Sadie Powell <sadie@witchery.services> | 2021-04-27 17:49:06 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2021-04-27 17:49:21 +0100 |
commit | e2aeab970bcbd94ea3531b345d2ec4df111f0d60 (patch) | |
tree | fab4021c9e78bf9a63045d7d0e5cd9ea9acb60ab /modules | |
parent | ef4fd869ae634b546a882b1741303705fa216fc7 (diff) |
Remove the repeated conditions in cmake endif/else statements.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/CMakeLists.txt | 66 | ||||
-rw-r--r-- | modules/third/language/CMakeLists.txt | 6 |
2 files changed, 36 insertions, 36 deletions
diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 7894b8c11..200569e2d 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -1,21 +1,21 @@ # 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 "\\.c$" ANOPE18MODULE ${MODULE_SRC}) if(ANOPE18MODULE) message(FATAL_ERROR "Anope 1 modules are not compatible with Anope 2!\nOffending module: ${MODULE_SRC}") - endif(ANOPE18MODULE) + endif() string(REGEX MATCH "\\.cpp$" CPP ${MODULE_SRC}) if(CPP) set_source_files_properties(${MODULE_SRC} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}") @@ -30,7 +30,7 @@ macro(build_modules SRC) # If there were some extra include directories, add them to the list if(TEMP_INCLUDES) append_to_list(EXTRA_INCLUDES ${TEMP_INCLUDES}) - endif(TEMP_INCLUDES) + endif() # Reset linker flags set(TEMP_LDFLAGS) @@ -47,40 +47,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(${SO} 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(${SO} PROPERTIES LINKER_LANGUAGE CXX PREFIX "" SUFFIX "" LINK_FLAGS "${TEMP_LDFLAGS} ${WIN32_NO_LIBS}" INSTALL_RPATH_USE_LINK_PATH ON BUILD_WITH_INSTALL_RPATH ON) add_dependencies(${SO} ${PROGRAM_NAME}) if(GETTEXT_FOUND) add_dependencies(${SO} module_language) - endif(GETTEXT_FOUND) + endif() target_link_libraries(${SO} ${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(${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() # Set the module to be installed to the module directory under the data directory install(TARGETS ${SO} DESTINATION ${LIB_DIR}/modules) - endif(HAS_FUNCTION) - 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() + endif() + endforeach() + endif() +endmacro() macro(build_subdir) file(GLOB_RECURSE MODULES_SUBDIR_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp") @@ -104,7 +104,7 @@ macro(build_subdir) # If there were some extra include directories, add them to the list if(TEMP_INCLUDES) include_directories(${TEMP_INCLUDES}) - endif(TEMP_INCLUDES) + endif() # Reset linker flags set(TEMP_LDFLAGS) @@ -118,28 +118,28 @@ 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) - endif(HAS_FUNCTION) - endforeach(SRC ${MODULES_SUBDIR_SRCS}) + endif() + endif() + endforeach() # Continue if library and function requirements are met if(HAS_FUNCTION) # Remove duplicates from the linker flags if(SUBDIR_LDFLAGS) remove_list_duplicates(SUBDIR_LDFLAGS) - endif(SUBDIR_LDFLAGS) + endif() # Remove duplicates from the extra dependencies if(SUBDIR_EXTRA_DEPENDS) remove_list_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 it's linker flags, also set it to depend on the main Anope executable to be built beforehand add_library(${SO} MODULE ${MODULES_SUBDIR_SRCS}) @@ -147,23 +147,23 @@ 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 it's 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() # Set the module to be installed to the module directory under the data directory install(TARGETS ${SO} DESTINATION ${LIB_DIR}/modules) - endif(HAS_FUNCTION) -endmacro(build_subdir) + endif() +endmacro() include_directories(${CMAKE_CURRENT_SOURCE_DIR}) build_modules(${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/modules/third/language/CMakeLists.txt b/modules/third/language/CMakeLists.txt index 85278f5be..ce636b539 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() |