1
0
mirror of https://github.com/anope/anope.git synced 2026-07-01 07:05:44 +02:00

Remove the repeated conditions in cmake endif/else statements.

This commit is contained in:
Sadie Powell
2021-04-27 17:49:06 +01:00
parent ef4fd869ae
commit e2aeab970b
10 changed files with 294 additions and 294 deletions
+97 -97
View File
File diff suppressed because it is too large Load Diff
+115 -115
View File
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -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()
+2 -2
View File
@@ -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()
+9 -9
View File
@@ -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()
set(PCH_SOURCES_GCH "")
if(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
@@ -36,20 +36,20 @@ if(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
find_in_list(PCH_SOURCES "${FILENAME}" FOUND)
if(NOT FOUND EQUAL -1)
append_to_list(INCLUDES_LIST ${FILENAME})
endif(NOT FOUND EQUAL -1)
endif(QUOTE_TYPE STREQUAL "quotes")
endforeach(INCLUDE)
endif()
endif()
endforeach()
set(PCH_EXTRAFLAGS "")
if(DEBUG_BUILD)
set(PCH_EXTRAFLAGS "-g")
endif(DEBUG_BUILD)
endif()
if(PCH_SOURCE STREQUAL "module.h")
set(PCH_EXTRAFLAGS ${PCH_EXTRAFLAGS} -fPIC)
endif(PCH_SOURCE STREQUAL "module.h")
endif()
if(GETTEXT_INCLUDE)
set(PCH_GETTEXT_INCLUDE "-I${GETTEXT_INCLUDE}")
endif(GETTEXT_INCLUDE)
endif()
set(PCH_SOURCES_GCH "${PCH_SOURCES_GCH};${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch")
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch
@@ -57,8 +57,8 @@ if(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
${PCH_GETTEXT_INCLUDE} -I${CMAKE_CURRENT_BINARY_DIR} -I${Anope_SOURCE_DIR}/modules/pseudoclients ${CMAKE_CURRENT_SOURCE_DIR}/${PCH_SOURCE} -o ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch
DEPENDS ${INCLUDES_LIST} VERBATIM
)
endforeach(PCH_SOURCE ${PCH_SOURCES})
endif(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
endforeach()
endif()
# Add a custom target to the above file
add_custom_target(headers DEPENDS version-bin ${CMAKE_CURRENT_BINARY_DIR}/version_build ${PCH_SOURCES_GCH})
+3 -3
View File
@@ -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()
+33 -33
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -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()
+20 -20
View File
@@ -9,21 +9,21 @@ if(WIN32)
append_to_list(SRC_SRCS win32/pipe/pipe.cpp)
append_to_list(SRC_SRCS win32/pthread/pthread.cpp)
append_to_list(SRC_SRCS win32/sigaction/sigaction.cpp)
endif(WIN32)
endif()
if(HAVE_EPOLL)
append_to_list(SRC_SRCS socketengines/socketengine_epoll.cpp)
else(HAVE_EPOLL)
else()
if(HAVE_KQUEUE)
append_to_list(SRC_SRCS socketengines/socketengine_kqueue.cpp)
else(HAVE_KQUEUE)
else()
if(HAVE_POLL)
append_to_list(SRC_SRCS socketengines/socketengine_poll.cpp)
else(HAVE_POLL)
else()
append_to_list(SRC_SRCS socketengines/socketengine_select.cpp)
endif(HAVE_POLL)
endif(HAVE_KQUEUE)
endif(HAVE_EPOLL)
endif()
endif()
endif()
sort_list(SRC_SRCS)
@@ -41,13 +41,13 @@ foreach(SRC ${SRC_SRCS})
# 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)
endforeach(SRC)
endif()
endforeach()
# If there were extra include directories, remove the duplicates and add the directories to the include path
if(EXTRA_INCLUDES)
remove_list_duplicates(EXTRA_INCLUDES)
include_directories(${EXTRA_INCLUDES})
endif(EXTRA_INCLUDES)
endif()
# Under Windows, we also include a resource file to the build
if(WIN32)
@@ -61,13 +61,13 @@ if(WIN32)
# If any sort of debugging is being enabled, add a _DEBUG define to the flags for the resource compiler
if(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
set(RC_CFLAGS "${RC_CFLAGS} -D_DEBUG")
endif(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
endif()
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc COMPILE_FLAGS "${RC_CFLAGS}")
# For anything else, assumingly Visual Studio at this point, use a different set of compile flags
else(MINGW)
else()
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc COMPILE_FLAGS "/i\"${Anope_SOURCE_DIR}/include\"")
endif(MINGW)
endif(WIN32)
endif()
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)
@@ -75,9 +75,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})
@@ -86,15 +86,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)
@@ -108,7 +108,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}
+6 -6
View File
@@ -20,10 +20,10 @@ foreach(SRC ${TOOLS_SRCS})
# Only for Windows, set anopesmtp to require the wsock32 library
if(WIN32 AND ${EXE} STREQUAL anopesmtp)
target_link_libraries(${EXE} wsock32)
endif(WIN32 AND ${EXE} STREQUAL anopesmtp)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS" AND ${EXE} STREQUAL anopesmtp)
target_link_libraries(${EXE} socket nsl)
endif(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS" AND ${EXE} STREQUAL anopesmtp)
endif()
# Set the executable to be installed to the bin directory under the main directory
install(TARGETS ${EXE}
DESTINATION ${BIN_DIR}
@@ -32,8 +32,8 @@ 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)
endif(NOT SKIP)
endforeach(SRC)
endif()
endforeach()
# If not on Windows, generate anoperc and install it along with mydbgen
if(NOT WIN32)
@@ -44,9 +44,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()