summaryrefslogtreecommitdiff
path: root/Modules/GetPrerequisites.cmake
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2012-08-13 13:50:14 -0400
committerBrad King <brad.king@kitware.com>2012-08-13 14:19:16 -0400
commit9db3116226cb99fcf54e936c833953abcde9b729 (patch)
treebd755ed9e616bbf1482a894bc7946980d81b7703 /Modules/GetPrerequisites.cmake
parent77543bde41b0e52c3959016698b529835945d62d (diff)
downloadcmake-9db3116226cb99fcf54e936c833953abcde9b729.tar.gz
Remove CMake-language block-end command arguments
Ancient versions of CMake required else(), endif(), and similar block termination commands to have arguments matching the command starting the block. This is no longer the preferred style. Run the following shell code: for c in else endif endforeach endfunction endmacro endwhile; do echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | egrep -z -v 'Tests/CMakeTests/While-Endwhile-' | xargs -0 sed -i -f convert.sed && rm convert.sed
Diffstat (limited to 'Modules/GetPrerequisites.cmake')
-rw-r--r--Modules/GetPrerequisites.cmake194
1 files changed, 97 insertions, 97 deletions
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index d215685dd1..e51055f3ed 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -126,13 +126,13 @@ function(gp_append_unique list_var value)
if("${item}" STREQUAL "${value}")
set(contains 1)
break()
- endif("${item}" STREQUAL "${value}")
- endforeach(item)
+ endif()
+ endforeach()
if(NOT contains)
set(${list_var} ${${list_var}} "${value}" PARENT_SCOPE)
- endif(NOT contains)
-endfunction(gp_append_unique)
+ endif()
+endfunction()
function(is_file_executable file result_var)
@@ -150,13 +150,13 @@ function(is_file_executable file result_var)
if("${file_full_lower}" MATCHES "\\.exe$")
set(${result_var} 1 PARENT_SCOPE)
return()
- endif("${file_full_lower}" MATCHES "\\.exe$")
+ endif()
# A clause could be added here that uses output or return value of dumpbin
# to determine ${result_var}. In 99%+? practical cases, the exe name
# match will be sufficient...
#
- endif(WIN32 AND NOT UNIX)
+ endif()
# Use the information returned from the Unix shell command "file" to
# determine if ${file_full} should be considered an executable file...
@@ -168,7 +168,7 @@ function(is_file_executable file result_var)
if(UNIX)
if(NOT file_cmd)
find_program(file_cmd "file")
- endif(NOT file_cmd)
+ endif()
if(file_cmd)
execute_process(COMMAND "${file_cmd}" "${file_full}"
@@ -190,11 +190,11 @@ function(is_file_executable file result_var)
#message(STATUS "executable!")
if("${file_ov}" MATCHES "text")
#message(STATUS "but text, so *not* a binary executable!")
- else("${file_ov}" MATCHES "text")
+ else()
set(${result_var} 1 PARENT_SCOPE)
return()
- endif("${file_ov}" MATCHES "text")
- endif("${file_ov}" MATCHES "executable")
+ endif()
+ endif()
# Also detect position independent executables on Linux,
# where "file" gives "shared object ... (uses shared libraries)"
@@ -203,11 +203,11 @@ function(is_file_executable file result_var)
return()
endif()
- else(file_cmd)
+ else()
message(STATUS "warning: No 'file' command, skipping execute_process...")
- endif(file_cmd)
- endif(UNIX)
-endfunction(is_file_executable)
+ endif()
+ endif()
+endfunction()
function(gp_item_default_embedded_path item default_embedded_path_var)
@@ -240,7 +240,7 @@ function(gp_item_default_embedded_path item default_embedded_path_var)
if(item MATCHES "\\.dylib$")
set(path "@executable_path/../MacOS")
set(overridden 1)
- endif(item MATCHES "\\.dylib$")
+ endif()
# Embed frameworks in the embedded "Frameworks" directory (sibling of MacOS):
#
@@ -248,8 +248,8 @@ function(gp_item_default_embedded_path item default_embedded_path_var)
if(item MATCHES "[^/]+\\.framework/")
set(path "@executable_path/../Frameworks")
set(overridden 1)
- endif(item MATCHES "[^/]+\\.framework/")
- endif(NOT overridden)
+ endif()
+ endif()
endif()
# Provide a hook so that projects can override the default embedded location
@@ -257,10 +257,10 @@ function(gp_item_default_embedded_path item default_embedded_path_var)
#
if(COMMAND gp_item_default_embedded_path_override)
gp_item_default_embedded_path_override("${item}" path)
- endif(COMMAND gp_item_default_embedded_path_override)
+ endif()
set(${default_embedded_path_var} "${path}" PARENT_SCOPE)
-endfunction(gp_item_default_embedded_path)
+endfunction()
function(gp_resolve_item context item exepath dirs resolved_item_var)
@@ -271,7 +271,7 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
#
if(IS_ABSOLUTE "${resolved_item}" AND EXISTS "${resolved_item}")
set(resolved 1)
- endif(IS_ABSOLUTE "${resolved_item}" AND EXISTS "${resolved_item}")
+ endif()
if(NOT resolved)
if(item MATCHES "@executable_path")
@@ -285,11 +285,11 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
#message(STATUS "info: embedded item exists (${ri})")
set(resolved 1)
set(resolved_item "${ri}")
- else(EXISTS "${ri}")
+ else()
message(STATUS "warning: embedded item does not exist '${ri}'")
- endif(EXISTS "${ri}")
- endif(item MATCHES "@executable_path")
- endif(NOT resolved)
+ endif()
+ endif()
+ endif()
if(NOT resolved)
if(item MATCHES "@loader_path")
@@ -305,11 +305,11 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
#message(STATUS "info: embedded item exists (${ri})")
set(resolved 1)
set(resolved_item "${ri}")
- else(EXISTS "${ri}")
+ else()
message(STATUS "warning: embedded item does not exist '${ri}'")
- endif(EXISTS "${ri}")
- endif(item MATCHES "@loader_path")
- endif(NOT resolved)
+ endif()
+ endif()
+ endif()
if(NOT resolved)
if(item MATCHES "@rpath")
@@ -326,10 +326,10 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
set(resolved 1)
set(resolved_item "${ri}")
set(ri "ri-NOTFOUND")
- endif(ri)
+ endif()
- endif(item MATCHES "@rpath")
- endif(NOT resolved)
+ endif()
+ endif()
if(NOT resolved)
set(ri "ri-NOTFOUND")
@@ -340,8 +340,8 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
set(resolved 1)
set(resolved_item "${ri}")
set(ri "ri-NOTFOUND")
- endif(ri)
- endif(NOT resolved)
+ endif()
+ endif()
if(NOT resolved)
if(item MATCHES "[^/]+\\.framework/")
@@ -356,9 +356,9 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
set(resolved 1)
set(resolved_item "${fw}")
set(fw "fw-NOTFOUND")
- endif(fw)
- endif(item MATCHES "[^/]+\\.framework/")
- endif(NOT resolved)
+ endif()
+ endif()
+ endif()
# Using find_program on Windows will find dll files that are in the PATH.
# (Converting simple file names into full path names if found.)
@@ -373,16 +373,16 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
set(resolved 1)
set(resolved_item "${ri}")
set(ri "ri-NOTFOUND")
- endif(ri)
- endif(NOT resolved)
- endif(WIN32 AND NOT UNIX)
+ endif()
+ endif()
+ endif()
# Provide a hook so that projects can override item resolution
# by whatever logic they choose:
#
if(COMMAND gp_resolve_item_override)
gp_resolve_item_override("${context}" "${item}" "${exepath}" "${dirs}" resolved_item resolved)
- endif(COMMAND gp_resolve_item_override)
+ endif()
if(NOT resolved)
message(STATUS "
@@ -409,10 +409,10 @@ warning: cannot resolve item '${item}'
# resolved_item_var='${resolved_item_var}'
#******************************************************************************
#")
- endif(NOT resolved)
+ endif()
set(${resolved_item_var} "${resolved_item}" PARENT_SCOPE)
-endfunction(gp_resolve_item)
+endfunction()
function(gp_resolved_file_type original_file file exepath dirs type_var)
@@ -480,9 +480,9 @@ function(gp_resolved_file_type original_file file exepath dirs type_var)
if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)")
set(is_system 1)
endif()
- endif(CYGPATH_EXECUTABLE)
- endif(UNIX)
- endif(WIN32)
+ endif()
+ endif()
+ endif()
if(NOT is_system)
get_filename_component(original_path "${original_lower}" PATH)
@@ -551,7 +551,7 @@ function(gp_file_type original_file file type_var)
gp_resolved_file_type("${original_file}" "${file}" "${exepath}" "" type)
set(${type_var} "${type}" PARENT_SCOPE)
-endfunction(gp_file_type)
+endfunction()
function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs)
@@ -560,11 +560,11 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
if(NOT IS_ABSOLUTE "${target}")
message("warning: target '${target}' is not absolute...")
- endif(NOT IS_ABSOLUTE "${target}")
+ endif()
if(NOT EXISTS "${target}")
message("warning: target '${target}' does not exist...")
- endif(NOT EXISTS "${target}")
+ endif()
# <setup-gp_tool-vars>
#
@@ -575,11 +575,11 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(gp_tool "ldd")
if(APPLE)
set(gp_tool "otool")
- endif(APPLE)
+ endif()
if(WIN32 AND NOT UNIX) # This is how to check for cygwin, har!
set(gp_tool "dumpbin")
- endif(WIN32 AND NOT UNIX)
- endif("${gp_tool}" STREQUAL "")
+ endif()
+ endif()
set(gp_tool_known 0)
@@ -590,7 +590,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$")
set(gp_regex_cmp_count 1)
set(gp_tool_known 1)
- endif("${gp_tool}" STREQUAL "ldd")
+ endif()
if("${gp_tool}" STREQUAL "otool")
set(gp_cmd_args "-L")
@@ -599,7 +599,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(gp_regex_fallback "")
set(gp_regex_cmp_count 3)
set(gp_tool_known 1)
- endif("${gp_tool}" STREQUAL "otool")
+ endif()
if("${gp_tool}" STREQUAL "dumpbin")
set(gp_cmd_args "/dependents")
@@ -609,14 +609,14 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(gp_regex_cmp_count 1)
set(gp_tool_known 1)
set(ENV{VS_UNICODE_OUTPUT} "") # Block extra output from inside VS IDE.
- endif("${gp_tool}" STREQUAL "dumpbin")
+ endif()
if(NOT gp_tool_known)
message(STATUS "warning: gp_tool='${gp_tool}' is an unknown tool...")
message(STATUS "CMake function get_prerequisites needs more code to handle '${gp_tool}'")
message(STATUS "Valid gp_tool values are dumpbin, ldd and otool.")
return()
- endif(NOT gp_tool_known)
+ endif()
set(gp_cmd_paths ${gp_cmd_paths}
"C:/Program Files/Microsoft Visual Studio 9.0/VC/bin"
@@ -634,7 +634,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
if(NOT gp_cmd)
message(STATUS "warning: could not find '${gp_tool}' - cannot analyze prerequisites...")
return()
- endif(NOT gp_cmd)
+ endif()
if("${gp_tool}" STREQUAL "dumpbin")
# When running dumpbin, it also needs the "Common7/IDE" directory in the
@@ -654,14 +654,14 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
if("${gp_env_path_element}" STREQUAL "${gp_cmd_dlls_dir}")
set(gp_found_cmd_dlls_dir 1)
endif()
- endforeach(gp_env_path_element)
+ endforeach()
if(NOT gp_found_cmd_dlls_dir)
file(TO_NATIVE_PATH "${gp_cmd_dlls_dir}" gp_cmd_dlls_dir)
set(ENV{PATH} "$ENV{PATH};${gp_cmd_dlls_dir}")
endif()
- endif(EXISTS "${gp_cmd_dlls_dir}")
- endif("${gp_tool}" STREQUAL "dumpbin")
+ endif()
+ endif()
#
# </setup-gp_tool-vars>
@@ -669,8 +669,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
set(old_ld_env "$ENV{LD_LIBRARY_PATH}")
foreach(dir ${exepath} ${dirs})
set(ENV{LD_LIBRARY_PATH} "${dir}:$ENV{LD_LIBRARY_PATH}")
- endforeach(dir)
- endif("${gp_tool}" STREQUAL "ldd")
+ endforeach()
+ endif()
# Track new prerequisites at each new level of recursion. Start with an
@@ -687,13 +687,13 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
if("${gp_tool}" STREQUAL "ldd")
set(ENV{LD_LIBRARY_PATH} "${old_ld_env}")
- endif("${gp_tool}" STREQUAL "ldd")
+ endif()
if(verbose)
message(STATUS "<RawOutput cmd='${gp_cmd} ${gp_cmd_args} ${target}'>")
message(STATUS "gp_cmd_ov='${gp_cmd_ov}'")
message(STATUS "</RawOutput>")
- endif(verbose)
+ endif()
get_filename_component(target_dir "${target}" PATH)
@@ -716,8 +716,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
# trim
string(REGEX MATCH "[^\n ].*[^\n ]" gp_install_id "${gp_install_id}")
#message("INSTALL ID is \"${gp_install_id}\"")
- endif(gp_install_id)
- endif("${gp_tool}" STREQUAL "otool")
+ endif()
+ endif()
# Analyze each line for file names that match the regular expression:
#
@@ -727,23 +727,23 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
# Extract information from each candidate:
if(gp_regex_error AND "${candidate}" MATCHES "${gp_regex_error}")
string(REGEX REPLACE "${gp_regex_fallback}" "\\1" raw_item "${candidate}")
- else(gp_regex_error AND "${candidate}" MATCHES "${gp_regex_error}")
+ else()
string(REGEX REPLACE "${gp_regex}" "\\1" raw_item "${candidate}")
- endif(gp_regex_error AND "${candidate}" MATCHES "${gp_regex_error}")
+ endif()
if(gp_regex_cmp_count GREATER 1)
string(REGEX REPLACE "${gp_regex}" "\\2" raw_compat_version "${candidate}")
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" compat_major_version "${raw_compat_version}")
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" compat_minor_version "${raw_compat_version}")
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" compat_patch_version "${raw_compat_version}")
- endif(gp_regex_cmp_count GREATER 1)
+ endif()
if(gp_regex_cmp_count GREATER 2)
string(REGEX REPLACE "${gp_regex}" "\\3" raw_current_version "${candidate}")
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" current_major_version "${raw_current_version}")
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" current_minor_version "${raw_current_version}")
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" current_patch_version "${raw_current_version}")
- endif(gp_regex_cmp_count GREATER 2)
+ endif()
# Use the raw_item as the list entries returned by this function. Use the
# gp_resolve_item function to resolve it to an actual full path file if
@@ -757,7 +757,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
if("${item}" STREQUAL "${gp_install_id}")
set(add_item 0)
- endif("${item}" STREQUAL "${gp_install_id}")
+ endif()
if(add_item AND ${exclude_system})
set(type "")
@@ -765,8 +765,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
if("${type}" STREQUAL "system")
set(add_item 0)
- endif("${type}" STREQUAL "system")
- endif(add_item AND ${exclude_system})
+ endif()
+ endif()
if(add_item)
list(LENGTH ${prerequisites_var} list_length_before_append)
@@ -784,49 +784,49 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
if(NOT list_length_before_append EQUAL list_length_after_append)
gp_resolve_item("${target}" "${item}" "${exepath}" "${dirs}" resolved_item)
set(unseen_prereqs ${unseen_prereqs} "${resolved_item}")
- endif(NOT list_length_before_append EQUAL list_length_after_append)
- endif(${recurse})
- endif(add_item)
- else("${candidate}" MATCHES "${gp_regex}")
+ endif()
+ endif()
+ endif()
+ else()
if(verbose)
message(STATUS "ignoring non-matching line: '${candidate}'")
- endif(verbose)
- endif("${candidate}" MATCHES "${gp_regex}")
- endforeach(candidate)
+ endif()
+ endif()
+ endforeach()
list(LENGTH ${prerequisites_var} prerequisites_var_length)
if(prerequisites_var_length GREATER 0)
list(SORT ${prerequisites_var})
- endif(prerequisites_var_length GREATER 0)
+ endif()
if(${recurse})
set(more_inputs ${unseen_prereqs})
foreach(input ${more_inputs})
get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} ${recurse} "${exepath}" "${dirs}")
- endforeach(input)
- endif(${recurse})
+ endforeach()
+ endif()
set(${prerequisites_var} ${${prerequisites_var}} PARENT_SCOPE)
-endfunction(get_prerequisites)
+endfunction()
function(list_prerequisites target)
if("${ARGV1}" STREQUAL "")
set(all 1)
- else("${ARGV1}" STREQUAL "")
+ else()
set(all "${ARGV1}")
- endif("${ARGV1}" STREQUAL "")
+ endif()
if("${ARGV2}" STREQUAL "")
set(exclude_system 0)
- else("${ARGV2}" STREQUAL "")
+ else()
set(exclude_system "${ARGV2}")
- endif("${ARGV2}" STREQUAL "")
+ endif()
if("${ARGV3}" STREQUAL "")
set(verbose 0)
- else("${ARGV3}" STREQUAL "")
+ else()
set(verbose "${ARGV3}")
- endif("${ARGV3}" STREQUAL "")
+ endif()
set(count 0)
set(count_str "")
@@ -842,23 +842,23 @@ function(list_prerequisites target)
if(print_target)
message(STATUS "File '${target}' depends on:")
- endif(print_target)
+ endif()
foreach(d ${prereqs})
math(EXPR count "${count} + 1")
if(print_count)
set(count_str "${count}. ")
- endif(print_count)
+ endif()
if(print_prerequisite_type)
gp_file_type("${target}" "${d}" type)
set(type_str " (${type})")
- endif(print_prerequisite_type)
+ endif()
message(STATUS "${count_str}${d}${type_str}")
- endforeach(d)
-endfunction(list_prerequisites)
+ endforeach()
+endfunction()
function(list_prerequisites_by_glob glob_arg glob_exp)
@@ -872,6 +872,6 @@ function(list_prerequisites_by_glob glob_arg glob_exp)
message(STATUS "=============================================================================")
list_prerequisites("${f}" ${ARGN})
message(STATUS "")
- endif(is_f_executable)
- endforeach(f)
-endfunction(list_prerequisites_by_glob)
+ endif()
+ endforeach()
+endfunction()