diff options
| author | Peter Powell <petpow@saberuk.com> | 2015-12-15 00:12:57 +0000 |
|---|---|---|
| committer | Peter Powell <petpow@saberuk.com> | 2015-12-31 02:40:36 +0000 |
| commit | dd6688b9875bef4c3ce5e66fd19283ac931b72ea (patch) | |
| tree | 8ef774f4e50e04a72994e1c737ca1dced14bb085 /cmake | |
| parent | 63f865dcacf459f65b75a4269288b3090b14f956 (diff) | |
Remove repeated expressions from CMake end*() and else() calls.
Diffstat (limited to 'cmake')
| -rw-r--r-- | cmake/Anope.cmake | 40 | ||||
| -rw-r--r-- | cmake/FindGettext.cmake | 12 |
2 files changed, 26 insertions, 26 deletions
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() |
