cmake string(LENGTH) examples

ornladios/ADIOS2 cmake/ADIOSFunctions.cmake :65

string(RANDOM LENGTH ${pad_len} pad)

ornladios/ADIOS2 cmake/upstream/FindPython/Support.cmake :833

string (LENGTH "${dots}." count)

ornladios/ADIOS2 testing/adios2/engine/staging-common/TestSupp.cmake :299

string(LENGTH "${HEX}" _strlen)

ornladios/ADIOS2 testing/adios2/engine/staging-common/TestSupp.cmake :321

string(LENGTH "${HEX}" _strlen)

alembic/alembic CMakeLists.txt :297

STRING(LENGTH "${_msg}" _len)

assimp/assimp contrib/android-cmake/android.toolchain.cmake :434

string( LENGTH "${ANDROID_STANDALONE_TOOLCHAIN}" __length )

assimp/assimp contrib/android-cmake/android.toolchain.cmake :489

string( LENGTH "${ANDROID_NDK_TOOLCHAINS_PATH}" __length )

ambrop72/badvpn CMakeLists.txt :396

#    string(LENGTH "${name_withspaces}" length)

mono/boringssl third_party/android-cmake/android.toolchain.cmake :434

string( LENGTH "${ANDROID_STANDALONE_TOOLCHAIN}" __length )

mono/boringssl util/android-cmake/android.toolchain.cmake :489

string( LENGTH "${ANDROID_NDK_TOOLCHAINS_PATH}" __length )

google/brotli CMakeLists.txt :273

string(LENGTH "${path}" path_length)

google/brotli CMakeLists.txt :286

string(LENGTH "${value}" value_length)

catchorg/Catch2 extras/CatchAddTests.cmake :145

string(JSON num_tests LENGTH "${test_listing}")

catchorg/Catch2 extras/CatchAddTests.cmake :190

string(JSON num_tags LENGTH "${test_tags}")

catchorg/Catch2 extras/CatchShardTestsImpl.cmake :39

"string(RANDOM LENGTH 8 ALPHABET \"0123456789abcdef\" rng_seed)\n"

catchorg/Catch2 extras/ParseAndAddCatchTests.cmake :136

    string(REGEX MATCH "(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^,^\"]*" TestTypeAndFixture "${TestName}")
    string(REGEX MATCH "(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)" TestType "${TestTypeAndFixture}")
    string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")

    # Get string parts of test definition
    string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")

    # Strip wrapping quotation marks
    string(REGEX REPLACE "^\"(.*)\"$" "\\1" TestStrings "${TestStrings}")
    string(REPLACE "\";\"" ";" TestStrings "${TestStrings}")

    # Validate that a test name and tags have been provided
    list(LENGTH TestStrings TestStringsLength)
    if(TestStringsLength GREATER 2 OR TestStringsLength LESS 1)
      message(FATAL_ERROR "You must provide a valid test name and tags for all tests in ${SourceFile}")
    endif()

    # Assign name and tags
    list(GET TestStrings 0 Name)
    if("${TestType}" STREQUAL "SCENARIO")
      set(Name "Scenario: ${Name}")
    endif()
    if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND "${TestType}" MATCHES "(CATCH_)?TEST_CASE_METHOD" AND TestFixture)
      set(CTestName "${TestFixture}:${Name}")
    else()
      set(CTestName "${Name}")
    endif()
    if(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME)
      set(CTestName "${TestTarget}:${CTestName}")
    endif()
    # add target to labels to enable running all tests added from this target
    set(Labels ${TestTarget})
    if(TestStringsLength EQUAL 2)
      list(GET TestStrings 1 Tags)
      string(TOLOWER "${Tags}" Tags)
      # remove target from labels if the test is hidden
      if("${Tags}" MATCHES ".*\\[!?(hide|\\.)\\].*")
        list(REMOVE_ITEM Labels ${TestTarget})
      endif()
      string(REPLACE "]" ";" Tags "${Tags}")
      string(REPLACE "[" "" Tags "${Tags}")
    else()
      # unset tags variable from previous loop
      unset(Tags)
    endif()

    list(APPEND Labels ${Tags})

    set(HiddenTagFound OFF)
    foreach(label ${Labels})
      string(REGEX MATCH "^!hide|^\\." result ${label})
      if(result)
        set(HiddenTagFound ON)
        break()
      endif()
    endforeach(label)
    if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_LESS "3.9")
      ParseAndAddCatchTests_PrintDebugMessage("Skipping test \"${CTestName}\" as it has [!hide], [.] or [.foo] label")
    else()
      ParseAndAddCatchTests_PrintDebugMessage("Adding test \"${CTestName}\"")
      if(Labels)
        ParseAndAddCatchTests_PrintDebugMessage("Setting labels to ${Labels}")
      endif()

      # Escape commas in the test spec
      string(REPLACE "," "\\," Name ${Name})

      # Work around CMake 3.18.0 change in `add_test()`, before the escaped quotes were necessary,
      # only with CMake 3.18.0 the escaped double quotes confuse the call. This change is reverted in 3.18.1
      # And properly introduced in 3.19 with the CMP0110 policy
      if(_cmp0110_value STREQUAL "NEW" OR ${CMAKE_VERSION} VERSION_EQUAL "3.18")
        ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to NEW, no need for add_test(\"\") workaround")
      else()
        ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to OLD adding \"\" for add_test() workaround")
        set(CTestName "\"${CTestName}\"")
      endif()

      # Handle template test cases
      if("${TestTypeAndFixture}" MATCHES ".*TEMPLATE_.*")
        set(Name "${Name} - *")
      endif()

      # Add the test and set its properties
      add_test(NAME "${CTestName}" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
      # Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead
      if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
        ParseAndAddCatchTests_PrintDebugMessage("Setting DISABLED test property")
        set_tests_properties("${CTestName}" PROPERTIES DISABLED ON)
      else()
        set_tests_properties("${CTestName}" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
                                                LABELS "${Labels}")
      endif()
      set_property(
        TARGET ${TestTarget}
        APPEND
        PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
      set_property(
        SOURCE ${SourceFile}
        APPEND
        PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
    endif()
  endforeach()
endfunction()

# entry point
function(ParseAndAddCatchTests TestTarget)
  message(DEPRECATION "ParseAndAddCatchTest: function deprecated because of possibility of missed test cases. Consider using 'catch_discover_tests' from 'Catch.cmake'")
  ParseAndAddCatchTests_PrintDebugMessage("Started parsing ${TestTarget}")
  get_target_property(SourceFiles ${TestTarget} SOURCES)
  ParseAndAddCatchTests_PrintDebugMessage("Found the following sources: ${SourceFiles}")
  foreach(SourceFile ${SourceFiles})
    ParseAndAddCatchTests_ParseFile(${SourceFile} ${TestTarget})
  endforeach()
  ParseAndAddCatchTests_PrintDebugMessage("Finished parsing ${TestTarget}")
endfunction()

catchorg/Catch2 extras/ParseAndAddCatchTests.cmake :138

    string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")

    # Get string parts of test definition
    string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")

    # Strip wrapping quotation marks
    string(REGEX REPLACE "^\"(.*)\"$" "\\1" TestStrings "${TestStrings}")
    string(REPLACE "\";\"" ";" TestStrings "${TestStrings}")

    # Validate that a test name and tags have been provided
    list(LENGTH TestStrings TestStringsLength)
    if(TestStringsLength GREATER 2 OR TestStringsLength LESS 1)
      message(FATAL_ERROR "You must provide a valid test name and tags for all tests in ${SourceFile}")
    endif()

    # Assign name and tags
    list(GET TestStrings 0 Name)
    if("${TestType}" STREQUAL "SCENARIO")
      set(Name "Scenario: ${Name}")
    endif()
    if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND "${TestType}" MATCHES "(CATCH_)?TEST_CASE_METHOD" AND TestFixture)
      set(CTestName "${TestFixture}:${Name}")
    else()
      set(CTestName "${Name}")
    endif()
    if(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME)
      set(CTestName "${TestTarget}:${CTestName}")
    endif()
    # add target to labels to enable running all tests added from this target
    set(Labels ${TestTarget})
    if(TestStringsLength EQUAL 2)
      list(GET TestStrings 1 Tags)
      string(TOLOWER "${Tags}" Tags)
      # remove target from labels if the test is hidden
      if("${Tags}" MATCHES ".*\\[!?(hide|\\.)\\].*")
        list(REMOVE_ITEM Labels ${TestTarget})
      endif()
      string(REPLACE "]" ";" Tags "${Tags}")
      string(REPLACE "[" "" Tags "${Tags}")
    else()
      # unset tags variable from previous loop
      unset(Tags)
    endif()

    list(APPEND Labels ${Tags})

    set(HiddenTagFound OFF)
    foreach(label ${Labels})
      string(REGEX MATCH "^!hide|^\\." result ${label})
      if(result)
        set(HiddenTagFound ON)
        break()
      endif()
    endforeach(label)
    if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_LESS "3.9")
      ParseAndAddCatchTests_PrintDebugMessage("Skipping test \"${CTestName}\" as it has [!hide], [.] or [.foo] label")
    else()
      ParseAndAddCatchTests_PrintDebugMessage("Adding test \"${CTestName}\"")
      if(Labels)
        ParseAndAddCatchTests_PrintDebugMessage("Setting labels to ${Labels}")
      endif()

      # Escape commas in the test spec
      string(REPLACE "," "\\," Name ${Name})

      # Work around CMake 3.18.0 change in `add_test()`, before the escaped quotes were necessary,
      # only with CMake 3.18.0 the escaped double quotes confuse the call. This change is reverted in 3.18.1
      # And properly introduced in 3.19 with the CMP0110 policy
      if(_cmp0110_value STREQUAL "NEW" OR ${CMAKE_VERSION} VERSION_EQUAL "3.18")
        ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to NEW, no need for add_test(\"\") workaround")
      else()
        ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to OLD adding \"\" for add_test() workaround")
        set(CTestName "\"${CTestName}\"")
      endif()

      # Handle template test cases
      if("${TestTypeAndFixture}" MATCHES ".*TEMPLATE_.*")
        set(Name "${Name} - *")
      endif()

      # Add the test and set its properties
      add_test(NAME "${CTestName}" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
      # Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead
      if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
        ParseAndAddCatchTests_PrintDebugMessage("Setting DISABLED test property")
        set_tests_properties("${CTestName}" PROPERTIES DISABLED ON)
      else()
        set_tests_properties("${CTestName}" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
                                                LABELS "${Labels}")
      endif()
      set_property(
        TARGET ${TestTarget}
        APPEND
        PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
      set_property(
        SOURCE ${SourceFile}
        APPEND
        PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
    endif()
  endforeach()
endfunction()

# entry point
function(ParseAndAddCatchTests TestTarget)
  message(DEPRECATION "ParseAndAddCatchTest: function deprecated because of possibility of missed test cases. Consider using 'catch_discover_tests' from 'Catch.cmake'")
  ParseAndAddCatchTests_PrintDebugMessage("Started parsing ${TestTarget}")
  get_target_property(SourceFiles ${TestTarget} SOURCES)
  ParseAndAddCatchTests_PrintDebugMessage("Found the following sources: ${SourceFiles}")
  foreach(SourceFile ${SourceFiles})
    ParseAndAddCatchTests_ParseFile(${SourceFile} ${TestTarget})
  endforeach()
  ParseAndAddCatchTests_PrintDebugMessage("Finished parsing ${TestTarget}")
endfunction()

ccache/ccache cmake/Utils.cmake :72

string(LENGTH "${name}" name_length)

ccache/ccache cmake/Utils.cmake :76

string(LENGTH "${version}" version_length)

CGAL/cgal Installation/CMakeLists.txt :175

string(LENGTH "${CGAL_MAJOR_VERSION}" CGAL_MAJOR_LEN)

CGAL/cgal Installation/CMakeLists.txt :179

string(LENGTH "${CGAL_MINOR_VERSION}" CGAL_MINOR_LEN)

CGAL/cgal Installation/CMakeLists.txt :187

string(LENGTH "${CGAL_TMP_BUILD}" CGAL_BUILD_LEN)

CGAL/cgal Installation/CMakeLists.txt :191

string(LENGTH "${CGAL_TMP_BUILD}" CGAL_BUILD_LEN)

CGAL/cgal Installation/cmake/modules/CGALHelpers.cmake :38

string(LENGTH "${plural_name}" plural_name_length)

projectchrono/chrono src/CMakeLists.txt :568

string(LENGTH "${CMAKE_SOURCE_DIR}/src/" SOURCE_PATH_SIZE)

civetweb/civetweb cmake/FindWinSock.cmake :57

string(SUBSTRING "${ERR}" ${START} ${LENGTH} WINSOCK_INCLUDE_PATHS)

knik0/faad2 CMakeLists.txt :196

string(LENGTH "${value}" value_length)

fltk/fltk CMake/fl_debug_var.cmake :39

string(LENGTH "${in}" len)

facebook/folly CMake/FollyFunctions.cmake :127

string(LENGTH "${filePath}" filePathLength)

facebook/folly CMake/FollyFunctions.cmake :149

string(LENGTH "${rootDir}" rootDirLength)

facebook/folly CMake/FollyFunctions.cmake :159

string(LENGTH "${filePath}" filePathLength)

FreeCAD/FreeCAD src/MacAppBundle/CMakeLists.txt :51

string(LENGTH "${ADDITIONAL_DIR}" DIR_LENGTH)

FreeRDP/FreeRDP channels/CMakeLists.txt :79

string(LENGTH "${_type}" _type_length)

malaterre/GDCM CMakeLists.txt :1098

string(LENGTH ${filename} filename_length)

HDFGroup/hdf4 config/cmake/jrunTest.cmake :297

string (LENGTH "${TEST_MATCH}" TEST_GREP_RESULT)

HDFGroup/hdf4 config/cmake/runTest.cmake :388

string (LENGTH "${TEST_MATCH}" TEST_GREP_RESULT)

HDFGroup/hdf4 config/cmake/UseJava.cmake :799

string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN)

HDFGroup/hdf4 config/cmake/UseJava.cmake :800

string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN)

HDFGroup/hdf4 HDF4Examples/config/cmake/runTest.cmake :388

string (LENGTH "${TEST_MATCH}" TEST_GREP_RESULT)

HDFGroup/hdf5 CMakeVOL.cmake :49

      string (REGEX MATCH "^[ \t]*set_tests_properties\\([ \t]*[\r\n]?" match_string "${line}")
      if (NOT "${match_string}" STREQUAL "")
        string (REGEX REPLACE "^[ \t]*set_tests_properties\\([ \t]*[\r\n]?" "" stripped_line "${line}")
      endif ()
      string (REGEX MATCH "^[ \t]*.\\{test\\}[ \t]*[\r\n]?" match_string "${line}")
      if (NOT "${match_string}" STREQUAL "")
        string (REGEX REPLACE "^[ \t]*.\\{[A-Za-z]*\\}[ \t]*[\r\n]?" "" stripped_line "${line}")
      endif ()
      string (REGEX MATCH "^[ \t]*PROPERTIES[ \t]*[\r\n]?" match_string "${line}")
      if (NOT "${match_string}" STREQUAL "")
        string (REGEX REPLACE "^[ \t]*PROPERTIES[ \t]*[\r\n]?" "" stripped_line "${line}")
      endif ()
      string (REGEX MATCH "^[ \t]*ENVIRONMENT[ \t]*.*[\r\n]?" match_string "${line}")
      if (NOT "${match_string}" STREQUAL "")
        string (REGEX REPLACE "^[ \t]*ENVIRONMENT[ \t]*.*[\r\n]?" "" stripped_line "${line}")
      endif ()
      file (APPEND "${source_dir}/tests/CMakeLists.txt" "${stripped_line}\n")
    endforeach ()
  endif ()
endfunction ()

set (HDF5_VOL_ALLOW_EXTERNAL "NO" CACHE STRING "Allow building of external HDF5 VOL connectors with FetchContent")
set_property (CACHE HDF5_VOL_ALLOW_EXTERNAL PROPERTY STRINGS NO GIT LOCAL_DIR)
mark_as_advanced (HDF5_VOL_ALLOW_EXTERNAL)
if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT" OR HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
  # For compatibility, set some variables that projects would
  # typically look for after calling find_package(HDF5)
  set (HDF5_FOUND 1)
  set (HDF5_LIBRARIES "${HDF5_LIBSH_TARGET};${LINK_LIBS};${LINK_COMP_LIBS};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPI::MPI_C>")
  set (HDF5_INCLUDE_DIRS "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
  set (HDF5_IS_PARALLEL ${H5_HAVE_PARALLEL})
  set (HDF5_VERSION ${HDF5_PACKAGE_VERSION})

  set (HDF5_C_LIBRARIES "${HDF5_LIBRARIES}")

  if (HDF5_BUILD_HL_LIB)
    set (HDF5_C_HL_LIBRARIES "${HDF5_HL_LIBSH_TARGET}")
  endif()

  set (HDF5_MAX_EXTERNAL_VOLS 10)
  set (HDF5_EXTERNAL_VOL_TARGETS "")

  foreach (vol_idx RANGE 1 ${HDF5_MAX_EXTERNAL_VOLS})
    # Generate fixed-width index number prepended with 0s
    # so VOL sources come in order from 1 - HDF5_MAX_EXTERNAL_VOLS
    set (vol_idx_num_digits 2) # Based on HDF5_MAX_EXTERNAL_VOLS
    set (vol_idx_fixed "${vol_idx}")
    string (LENGTH "${vol_idx_fixed}" vol_idx_len)
    while (vol_idx_len LESS vol_idx_num_digits)
      string (PREPEND vol_idx_fixed "0")
      math (EXPR vol_idx_len "${vol_idx_len}+1")
    endwhile ()

    if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
      set (HDF5_VOL_URL${vol_idx_fixed} "" CACHE STRING "Git repository URL of an external HDF5 VOL connector to build")
      mark_as_advanced (HDF5_VOL_URL${vol_idx_fixed})
      set (HDF5_VOL_SOURCE "${HDF5_VOL_URL${vol_idx_fixed}}")
    elseif(HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
      set (HDF5_VOL_PATH${vol_idx_fixed} "" CACHE STRING "Path to the source directory of an external HDF5 VOL connector to build")
      mark_as_advanced (HDF5_VOL_PATH${vol_idx_fixed})
      set (HDF5_VOL_SOURCE "${HDF5_VOL_PATH${vol_idx_fixed}}")
    endif()

    if (NOT "${HDF5_VOL_SOURCE}" STREQUAL "")
      # Deal with trailing slash in path for LOCAL_DIR case
      if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
        # Erase trailing slash
        string (REGEX REPLACE "/$" "" HDF5_VOL_SOURCE ${HDF5_VOL_SOURCE})
      endif()

      # Extract the name of the VOL connector
      string (FIND "${HDF5_VOL_SOURCE}" "/" hdf5_vol_name_pos REVERSE)
      if (hdf5_vol_name_pos EQUAL -1)
        if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
          message (SEND_ERROR "Invalid URL '${HDF5_VOL_SOURCE}' specified for HDF5_VOL_URL${vol_idx_fixed}")
        elseif (HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
          message (SEND_ERROR "Invalid source path '${HDF5_VOL_SOURCE}' specified for HDF5_VOL_PATH${vol_idx_fixed}")
        endif()
      endif ()

      math (EXPR hdf5_vol_name_pos "${hdf5_vol_name_pos}+1")

      string (SUBSTRING "${HDF5_VOL_SOURCE}" ${hdf5_vol_name_pos} -1 hdf5_vol_name)
      string (REPLACE ".git" "" hdf5_vol_name "${hdf5_vol_name}")
      string (STRIP "${hdf5_vol_name}" hdf5_vol_name)
      string (TOUPPER "${hdf5_vol_name}" hdf5_vol_name_upper)
      string (TOLOWER "${hdf5_vol_name}" hdf5_vol_name_lower)

      message (VERBOSE "Building VOL connector '${hdf5_vol_name}' with FetchContent from source ${HDF5_VOL_SOURCE}")

      # Set some cache variables that can be set by users when building
      if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
        set ("HDF5_VOL_${hdf5_vol_name_upper}_BRANCH" "main" CACHE STRING "Git branch (or tag) to use when building VOL connector '${hdf5_vol_name}'")
        mark_as_advanced ("HDF5_VOL_${hdf5_vol_name_upper}_BRANCH")
      endif()

      set ("HDF5_VOL_${hdf5_vol_name_upper}_CMAKE_PACKAGE_NAME"
        "${hdf5_vol_name_lower}"
        CACHE
        STRING
        "CMake package name used by find_package(...) calls for VOL connector '${hdf5_vol_name}'"
      )

      set ("HDF5_VOL_${hdf5_vol_name_upper}_NAME" "" CACHE STRING "Name of VOL connector to set for the HDF5_VOL_CONNECTOR environment variable")
      option ("HDF5_VOL_${hdf5_vol_name_upper}_TEST_PARALLEL" "Whether to test VOL connector '${hdf5_vol_name}' against the parallel API tests" OFF)

      mark_as_advanced ("HDF5_VOL_${hdf5_vol_name_upper}_NAME")
      mark_as_advanced ("HDF5_VOL_${hdf5_vol_name_upper}_TEST_PARALLEL")

      if (HDF5_TEST_API)
        if ("${HDF5_VOL_${hdf5_vol_name_upper}_NAME}" STREQUAL "")
          message (SEND_ERROR "HDF5_VOL_${hdf5_vol_name_upper}_NAME must be set to a valid connector name to use VOL connector '${hdf5_vol_name}' for testing")
        endif ()
      endif ()

      if ((HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT") AND ("${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}" STREQUAL ""))
        message (SEND_ERROR "HDF5_VOL_${hdf5_vol_name_upper}_BRANCH must be set to a valid git branch name (or git tag) to build VOL connector '${hdf5_vol_name}'")
      endif ()

      if ((HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
        AND NOT (EXISTS ${HDF5_VOL_SOURCE} AND IS_DIRECTORY ${HDF5_VOL_SOURCE}))
          message (FATAL_ERROR "HDF5_VOL_PATH${vol_idx_fixed} must be an absolute path to a valid directory")
      endif ()

      # Set internal convenience variables for FetchContent dependency name
      set (hdf5_vol_depname "${HDF5_VOL_${hdf5_vol_name_upper}_CMAKE_PACKAGE_NAME}")
      string (TOLOWER "${hdf5_vol_depname}" hdf5_vol_depname_lower)

      if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24")
        set("OVERRIDE_FIND_PACKAGE_OPT" "OVERRIDE_FIND_PACKAGE")
      endif()

      if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
        FetchContent_Declare (${hdf5_vol_depname}
            GIT_REPOSITORY "${HDF5_VOL_SOURCE}"
            GIT_TAG "${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}"
            "${OVERRIDE_FIND_PACKAGE_OPT}"
        )
      elseif(HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
        FetchContent_Declare (${hdf5_vol_depname}
          SOURCE_DIR "${HDF5_VOL_SOURCE}"
        )
      endif()

      FetchContent_GetProperties(${hdf5_vol_depname})
      if (NOT ${hdf5_vol_depname}_POPULATED)
        FetchContent_Populate(${hdf5_vol_depname})

        # Now that content has been populated, set other internal
        # convenience variables for FetchContent dependency
        set (hdf5_vol_depname_source_dir "${${hdf5_vol_depname_lower}_SOURCE_DIR}")
        set (hdf5_vol_depname_binary_dir "${${hdf5_vol_depname_lower}_BINARY_DIR}")

        if (NOT EXISTS "${hdf5_vol_depname_source_dir}/CMakeLists.txt")
          if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
            message (SEND_ERROR "The git repository branch '${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}' for VOL connector '${hdf5_vol_name}' does not appear to contain a CMakeLists.txt file")
          elseif (HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
            message(SEND_ERROR "The local directory '${HDF5_VOL_SOURCE}' for VOL connector '${hdf5_vol_name}' does not appear to contain a CMakeLists.txt file")
          endif()
        endif ()

        # If there are any calls to find_package(HDF5) in the connector's
        # CMakeLists.txt files, remove those since any found HDF5 targets
        # will conflict with targets being generated by this build of HDF5
        if (EXISTS "${hdf5_vol_depname_source_dir}/CMakeLists.txt")
          file (READ "${hdf5_vol_depname_source_dir}/CMakeLists.txt" vol_cmake_contents)
          string (REGEX REPLACE "[ \t]*find_package[ \t]*\\([ \t]*HDF5[^\r\n\\)]*\\)[ \t]*[\r\n]+" "" vol_cmake_contents "${vol_cmake_contents}")
          file (WRITE "${hdf5_vol_depname_source_dir}/CMakeLists.txt" "${vol_cmake_contents}")
        endif ()
        if (EXISTS "${hdf5_vol_depname_source_dir}/src/CMakeLists.txt")
          file (READ "${hdf5_vol_depname_source_dir}/src/CMakeLists.txt" vol_cmake_contents)
          string (REGEX REPLACE "[ \t]*find_package[ \t]*\\([ \t]*HDF5[^\r\n\\)]*\\)[ \t]*[\r\n]+" "" vol_cmake_contents "${vol_cmake_contents}")

HDFGroup/hdf5 CMakeVOL.cmake :51

        string (REGEX REPLACE "^[ \t]*set_tests_properties\\([ \t]*[\r\n]?" "" stripped_line "${line}")
      endif ()
      string (REGEX MATCH "^[ \t]*.\\{test\\}[ \t]*[\r\n]?" match_string "${line}")
      if (NOT "${match_string}" STREQUAL "")
        string (REGEX REPLACE "^[ \t]*.\\{[A-Za-z]*\\}[ \t]*[\r\n]?" "" stripped_line "${line}")
      endif ()
      string (REGEX MATCH "^[ \t]*PROPERTIES[ \t]*[\r\n]?" match_string "${line}")
      if (NOT "${match_string}" STREQUAL "")
        string (REGEX REPLACE "^[ \t]*PROPERTIES[ \t]*[\r\n]?" "" stripped_line "${line}")
      endif ()
      string (REGEX MATCH "^[ \t]*ENVIRONMENT[ \t]*.*[\r\n]?" match_string "${line}")
      if (NOT "${match_string}" STREQUAL "")
        string (REGEX REPLACE "^[ \t]*ENVIRONMENT[ \t]*.*[\r\n]?" "" stripped_line "${line}")
      endif ()
      file (APPEND "${source_dir}/tests/CMakeLists.txt" "${stripped_line}\n")
    endforeach ()
  endif ()
endfunction ()

set (HDF5_VOL_ALLOW_EXTERNAL "NO" CACHE STRING "Allow building of external HDF5 VOL connectors with FetchContent")
set_property (CACHE HDF5_VOL_ALLOW_EXTERNAL PROPERTY STRINGS NO GIT LOCAL_DIR)
mark_as_advanced (HDF5_VOL_ALLOW_EXTERNAL)
if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT" OR HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
  # For compatibility, set some variables that projects would
  # typically look for after calling find_package(HDF5)
  set (HDF5_FOUND 1)
  set (HDF5_LIBRARIES "${HDF5_LIBSH_TARGET};${LINK_LIBS};${LINK_COMP_LIBS};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPI::MPI_C>")
  set (HDF5_INCLUDE_DIRS "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
  set (HDF5_IS_PARALLEL ${H5_HAVE_PARALLEL})
  set (HDF5_VERSION ${HDF5_PACKAGE_VERSION})

  set (HDF5_C_LIBRARIES "${HDF5_LIBRARIES}")

  if (HDF5_BUILD_HL_LIB)
    set (HDF5_C_HL_LIBRARIES "${HDF5_HL_LIBSH_TARGET}")
  endif()

  set (HDF5_MAX_EXTERNAL_VOLS 10)
  set (HDF5_EXTERNAL_VOL_TARGETS "")

  foreach (vol_idx RANGE 1 ${HDF5_MAX_EXTERNAL_VOLS})
    # Generate fixed-width index number prepended with 0s
    # so VOL sources come in order from 1 - HDF5_MAX_EXTERNAL_VOLS
    set (vol_idx_num_digits 2) # Based on HDF5_MAX_EXTERNAL_VOLS
    set (vol_idx_fixed "${vol_idx}")
    string (LENGTH "${vol_idx_fixed}" vol_idx_len)
    while (vol_idx_len LESS vol_idx_num_digits)
      string (PREPEND vol_idx_fixed "0")
      math (EXPR vol_idx_len "${vol_idx_len}+1")
    endwhile ()

    if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
      set (HDF5_VOL_URL${vol_idx_fixed} "" CACHE STRING "Git repository URL of an external HDF5 VOL connector to build")
      mark_as_advanced (HDF5_VOL_URL${vol_idx_fixed})
      set (HDF5_VOL_SOURCE "${HDF5_VOL_URL${vol_idx_fixed}}")
    elseif(HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
      set (HDF5_VOL_PATH${vol_idx_fixed} "" CACHE STRING "Path to the source directory of an external HDF5 VOL connector to build")
      mark_as_advanced (HDF5_VOL_PATH${vol_idx_fixed})
      set (HDF5_VOL_SOURCE "${HDF5_VOL_PATH${vol_idx_fixed}}")
    endif()

    if (NOT "${HDF5_VOL_SOURCE}" STREQUAL "")
      # Deal with trailing slash in path for LOCAL_DIR case
      if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
        # Erase trailing slash
        string (REGEX REPLACE "/$" "" HDF5_VOL_SOURCE ${HDF5_VOL_SOURCE})
      endif()

      # Extract the name of the VOL connector
      string (FIND "${HDF5_VOL_SOURCE}" "/" hdf5_vol_name_pos REVERSE)
      if (hdf5_vol_name_pos EQUAL -1)
        if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
          message (SEND_ERROR "Invalid URL '${HDF5_VOL_SOURCE}' specified for HDF5_VOL_URL${vol_idx_fixed}")
        elseif (HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
          message (SEND_ERROR "Invalid source path '${HDF5_VOL_SOURCE}' specified for HDF5_VOL_PATH${vol_idx_fixed}")
        endif()
      endif ()

      math (EXPR hdf5_vol_name_pos "${hdf5_vol_name_pos}+1")

      string (SUBSTRING "${HDF5_VOL_SOURCE}" ${hdf5_vol_name_pos} -1 hdf5_vol_name)
      string (REPLACE ".git" "" hdf5_vol_name "${hdf5_vol_name}")
      string (STRIP "${hdf5_vol_name}" hdf5_vol_name)
      string (TOUPPER "${hdf5_vol_name}" hdf5_vol_name_upper)
      string (TOLOWER "${hdf5_vol_name}" hdf5_vol_name_lower)

      message (VERBOSE "Building VOL connector '${hdf5_vol_name}' with FetchContent from source ${HDF5_VOL_SOURCE}")

      # Set some cache variables that can be set by users when building
      if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
        set ("HDF5_VOL_${hdf5_vol_name_upper}_BRANCH" "main" CACHE STRING "Git branch (or tag) to use when building VOL connector '${hdf5_vol_name}'")
        mark_as_advanced ("HDF5_VOL_${hdf5_vol_name_upper}_BRANCH")
      endif()

      set ("HDF5_VOL_${hdf5_vol_name_upper}_CMAKE_PACKAGE_NAME"
        "${hdf5_vol_name_lower}"
        CACHE
        STRING
        "CMake package name used by find_package(...) calls for VOL connector '${hdf5_vol_name}'"
      )

      set ("HDF5_VOL_${hdf5_vol_name_upper}_NAME" "" CACHE STRING "Name of VOL connector to set for the HDF5_VOL_CONNECTOR environment variable")
      option ("HDF5_VOL_${hdf5_vol_name_upper}_TEST_PARALLEL" "Whether to test VOL connector '${hdf5_vol_name}' against the parallel API tests" OFF)

      mark_as_advanced ("HDF5_VOL_${hdf5_vol_name_upper}_NAME")
      mark_as_advanced ("HDF5_VOL_${hdf5_vol_name_upper}_TEST_PARALLEL")

      if (HDF5_TEST_API)
        if ("${HDF5_VOL_${hdf5_vol_name_upper}_NAME}" STREQUAL "")
          message (SEND_ERROR "HDF5_VOL_${hdf5_vol_name_upper}_NAME must be set to a valid connector name to use VOL connector '${hdf5_vol_name}' for testing")
        endif ()
      endif ()

      if ((HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT") AND ("${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}" STREQUAL ""))
        message (SEND_ERROR "HDF5_VOL_${hdf5_vol_name_upper}_BRANCH must be set to a valid git branch name (or git tag) to build VOL connector '${hdf5_vol_name}'")
      endif ()

      if ((HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
        AND NOT (EXISTS ${HDF5_VOL_SOURCE} AND IS_DIRECTORY ${HDF5_VOL_SOURCE}))
          message (FATAL_ERROR "HDF5_VOL_PATH${vol_idx_fixed} must be an absolute path to a valid directory")
      endif ()

      # Set internal convenience variables for FetchContent dependency name
      set (hdf5_vol_depname "${HDF5_VOL_${hdf5_vol_name_upper}_CMAKE_PACKAGE_NAME}")
      string (TOLOWER "${hdf5_vol_depname}" hdf5_vol_depname_lower)

      if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24")
        set("OVERRIDE_FIND_PACKAGE_OPT" "OVERRIDE_FIND_PACKAGE")
      endif()

      if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
        FetchContent_Declare (${hdf5_vol_depname}
            GIT_REPOSITORY "${HDF5_VOL_SOURCE}"
            GIT_TAG "${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}"
            "${OVERRIDE_FIND_PACKAGE_OPT}"
        )
      elseif(HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
        FetchContent_Declare (${hdf5_vol_depname}
          SOURCE_DIR "${HDF5_VOL_SOURCE}"
        )
      endif()

      FetchContent_GetProperties(${hdf5_vol_depname})
      if (NOT ${hdf5_vol_depname}_POPULATED)
        FetchContent_Populate(${hdf5_vol_depname})

        # Now that content has been populated, set other internal
        # convenience variables for FetchContent dependency
        set (hdf5_vol_depname_source_dir "${${hdf5_vol_depname_lower}_SOURCE_DIR}")
        set (hdf5_vol_depname_binary_dir "${${hdf5_vol_depname_lower}_BINARY_DIR}")

        if (NOT EXISTS "${hdf5_vol_depname_source_dir}/CMakeLists.txt")
          if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
            message (SEND_ERROR "The git repository branch '${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}' for VOL connector '${hdf5_vol_name}' does not appear to contain a CMakeLists.txt file")
          elseif (HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
            message(SEND_ERROR "The local directory '${HDF5_VOL_SOURCE}' for VOL connector '${hdf5_vol_name}' does not appear to contain a CMakeLists.txt file")
          endif()
        endif ()

        # If there are any calls to find_package(HDF5) in the connector's
        # CMakeLists.txt files, remove those since any found HDF5 targets
        # will conflict with targets being generated by this build of HDF5
        if (EXISTS "${hdf5_vol_depname_source_dir}/CMakeLists.txt")
          file (READ "${hdf5_vol_depname_source_dir}/CMakeLists.txt" vol_cmake_contents)
          string (REGEX REPLACE "[ \t]*find_package[ \t]*\\([ \t]*HDF5[^\r\n\\)]*\\)[ \t]*[\r\n]+" "" vol_cmake_contents "${vol_cmake_contents}")

HDFGroup/hdf5 config/cmake/fileCompareTest.cmake :43

string (LENGTH ${TEST_TWO_STRING} TEST_TWO_STRING_LEN)

HDFGroup/hdf5 HDF5Examples/config/cmake/runExecute.cmake :483

string (LENGTH "${REGEX_MATCH}" TEST_GREP_RESULT)

dscharrer/innoextract cmake/VersionScript.cmake :75

string(LENGTH "${git_head}" git_head_length)

InsightSoftwareConsortium/ITK CMakeLists.txt :109

string(LENGTH "${CMAKE_CURRENT_BINARY_DIR}" n)

InsightSoftwareConsortium/ITK CMake/ExternalData.cmake :553

string(RANDOM LENGTH 6 random)

InsightSoftwareConsortium/ITK CMake/ITKGroups.cmake :82

    string(
      REGEX MATCH
            "itk_module[ \n]*(\\([ \n]*)([A-Za-z0-9]*)"
            _module_name
            ${_module_file_content})
    set(_module_name ${CMAKE_MATCH_2})
    set(_${_module_name}_module_line ${_module_line})
    list(APPEND _${group}_module_list ${_module_name})
  endforeach()
endforeach()

#------------------------------------------------
# Set up Doxygen Group descriptions

set(group_list_dox)
foreach(group ${group_list})
  set(group_list_dox
      "${group_list_dox}
// -----------------------------------------------
// Group ${group}
/** \\defgroup Group-${group} Group ${group}
${${group}_documentation} */\n")

  foreach(mod ${_${group}_module_list})
    set(group_list_dox
        "${group_list_dox}
/** \\defgroup ${mod} Module ${mod}
\\ingroup Group-${group} */\n")
  endforeach()
endforeach()

set(_content ${group_list_dox})
configure_file("${ITK_SOURCE_DIR}/Utilities/Doxygen/Module.dox.in"
               "${ITK_BINARY_DIR}/Utilities/Doxygen/Modules/ITK-AllGroups.dox")

#------------------------------------------------
# Turn on the ITK_BUILD option for each group

# Set a module name list for each group and exclude
# Modules that should be OFF
foreach(group ${group_list})
  set(_${group}_on_module_list)
  list(LENGTH _${group}_module_list _num_modules)
  set(_current_module 0)
  while(${_current_module} LESS ${_num_modules})
    list(
      GET
      _${group}_module_list
      ${_current_module}
      _module_name)
    if(NOT ITK_MODULE_${_module_name}_EXCLUDE_FROM_DEFAULT)
      list(APPEND _${group}_on_module_list ${_module_name})
    endif()
    math(EXPR _current_module "${_current_module} + 1")
  endwhile()
endforeach()

if("$ENV{DASHBOARD_TEST_FROM_CTEST}" STREQUAL "")
  # developer build
  option(ITKGroup_Core "Request building core modules" ON)
endif()
foreach(group ${group_list})
  option(ITKGroup_${group} "Request building ${group} modules" OFF)
  if(ITKGroup_${group})
    foreach(itk-module ${_${group}_on_module_list})
      list(APPEND ITK_MODULE_${itk-module}_REQUEST_BY ITKGroup_${group})
    endforeach()
  endif()
  # Hide group options if building all modules anyway.
  if(ITK_BUILD_DEFAULT_MODULES)
    set_property(CACHE ITKGroup_${group} PROPERTY TYPE INTERNAL)
  else()
    set_property(CACHE ITKGroup_${group} PROPERTY TYPE BOOL)
  endif()
endforeach()

InsightSoftwareConsortium/ITK Modules/ThirdParty/GDCM/src/gdcm/CMakeLists.txt :479

#string(LENGTH ${import_output} len)

InsightSoftwareConsortium/ITK Modules/ThirdParty/HDF5/src/itkhdf5/CMakeVOL.cmake :49

      string (REGEX MATCH "^[ \t]*set_tests_properties\\([ \t]*[\r\n]?" match_string "${line}")
      if (NOT "${match_string}" STREQUAL "")
        string (REGEX REPLACE "^[ \t]*set_tests_properties\\([ \t]*[\r\n]?" "" stripped_line "${line}")
      endif ()
      string (REGEX MATCH "^[ \t]*.\\{test\\}[ \t]*[\r\n]?" match_string "${line}")
      if (NOT "${match_string}" STREQUAL "")
        string (REGEX REPLACE "^[ \t]*.\\{[A-Za-z]*\\}[ \t]*[\r\n]?" "" stripped_line "${line}")
      endif ()
      string (REGEX MATCH "^[ \t]*PROPERTIES[ \t]*[\r\n]?" match_string "${line}")
      if (NOT "${match_string}" STREQUAL "")
        string (REGEX REPLACE "^[ \t]*PROPERTIES[ \t]*[\r\n]?" "" stripped_line "${line}")
      endif ()
      string (REGEX MATCH "^[ \t]*ENVIRONMENT[ \t]*.*[\r\n]?" match_string "${line}")
      if (NOT "${match_string}" STREQUAL "")
        string (REGEX REPLACE "^[ \t]*ENVIRONMENT[ \t]*.*[\r\n]?" "" stripped_line "${line}")
      endif ()
      file (APPEND "${source_dir}/tests/CMakeLists.txt" "${stripped_line}\n")
    endforeach ()
  endif ()
endfunction ()

set (HDF5_VOL_ALLOW_EXTERNAL "NO" CACHE STRING "Allow building of external HDF5 VOL connectors with FetchContent")
set_property (CACHE HDF5_VOL_ALLOW_EXTERNAL PROPERTY STRINGS NO GIT LOCAL_DIR)
mark_as_advanced (HDF5_VOL_ALLOW_EXTERNAL)
if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT" OR HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
  # For compatibility, set some variables that projects would
  # typically look for after calling find_package(HDF5)
  set (HDF5_FOUND 1)
  set (HDF5_LIBRARIES "${HDF5_LIBSH_TARGET};${LINK_LIBS};${LINK_COMP_LIBS};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPI::MPI_C>")
  set (HDF5_INCLUDE_DIRS "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
  set (HDF5_IS_PARALLEL ${H5_HAVE_PARALLEL})
  set (HDF5_VERSION ${HDF5_PACKAGE_VERSION})

  set (HDF5_C_LIBRARIES "${HDF5_LIBRARIES}")

  if (HDF5_BUILD_HL_LIB)
    set (HDF5_C_HL_LIBRARIES "${HDF5_HL_LIBSH_TARGET}")
  endif()

  set (HDF5_MAX_EXTERNAL_VOLS 10)
  set (HDF5_EXTERNAL_VOL_TARGETS "")

  foreach (vol_idx RANGE 1 ${HDF5_MAX_EXTERNAL_VOLS})
    # Generate fixed-width index number prepended with 0s
    # so VOL sources come in order from 1 - HDF5_MAX_EXTERNAL_VOLS
    set (vol_idx_num_digits 2) # Based on HDF5_MAX_EXTERNAL_VOLS
    set (vol_idx_fixed "${vol_idx}")
    string (LENGTH "${vol_idx_fixed}" vol_idx_len)
    while (vol_idx_len LESS vol_idx_num_digits)
      string (PREPEND vol_idx_fixed "0")
      math (EXPR vol_idx_len "${vol_idx_len}+1")
    endwhile ()

    if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
      set (HDF5_VOL_URL${vol_idx_fixed} "" CACHE STRING "Git repository URL of an external HDF5 VOL connector to build")
      mark_as_advanced (HDF5_VOL_URL${vol_idx_fixed})
      set (HDF5_VOL_SOURCE "${HDF5_VOL_URL${vol_idx_fixed}}")
    elseif(HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
      set (HDF5_VOL_PATH${vol_idx_fixed} "" CACHE STRING "Path to the source directory of an external HDF5 VOL connector to build")
      mark_as_advanced (HDF5_VOL_PATH${vol_idx_fixed})
      set (HDF5_VOL_SOURCE "${HDF5_VOL_PATH${vol_idx_fixed}}")
    endif()

    if (NOT "${HDF5_VOL_SOURCE}" STREQUAL "")
      # Deal with trailing slash in path for LOCAL_DIR case
      if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
        # Erase trailing slash
        string (REGEX REPLACE "/$" "" HDF5_VOL_SOURCE ${HDF5_VOL_SOURCE})
      endif()

      # Extract the name of the VOL connector
      string (FIND "${HDF5_VOL_SOURCE}" "/" hdf5_vol_name_pos REVERSE)
      if (hdf5_vol_name_pos EQUAL -1)
        if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
          message (SEND_ERROR "Invalid URL '${HDF5_VOL_SOURCE}' specified for HDF5_VOL_URL${vol_idx_fixed}")
        elseif (HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
          message (SEND_ERROR "Invalid source path '${HDF5_VOL_SOURCE}' specified for HDF5_VOL_PATH${vol_idx_fixed}")
        endif()
      endif ()

      math (EXPR hdf5_vol_name_pos "${hdf5_vol_name_pos}+1")

      string (SUBSTRING "${HDF5_VOL_SOURCE}" ${hdf5_vol_name_pos} -1 hdf5_vol_name)
      string (REPLACE ".git" "" hdf5_vol_name "${hdf5_vol_name}")
      string (STRIP "${hdf5_vol_name}" hdf5_vol_name)
      string (TOUPPER "${hdf5_vol_name}" hdf5_vol_name_upper)
      string (TOLOWER "${hdf5_vol_name}" hdf5_vol_name_lower)

      message (VERBOSE "Building VOL connector '${hdf5_vol_name}' with FetchContent from source ${HDF5_VOL_SOURCE}")

      # Set some cache variables that can be set by users when building
      if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
        set ("HDF5_VOL_${hdf5_vol_name_upper}_BRANCH" "main" CACHE STRING "Git branch (or tag) to use when building VOL connector '${hdf5_vol_name}'")
        mark_as_advanced ("HDF5_VOL_${hdf5_vol_name_upper}_BRANCH")
      endif()

      set ("HDF5_VOL_${hdf5_vol_name_upper}_CMAKE_PACKAGE_NAME"
        "${hdf5_vol_name_lower}"
        CACHE
        STRING
        "CMake package name used by find_package(...) calls for VOL connector '${hdf5_vol_name}'"
      )

      set ("HDF5_VOL_${hdf5_vol_name_upper}_NAME" "" CACHE STRING "Name of VOL connector to set for the HDF5_VOL_CONNECTOR environment variable")
      option ("HDF5_VOL_${hdf5_vol_name_upper}_TEST_PARALLEL" "Whether to test VOL connector '${hdf5_vol_name}' against the parallel API tests" OFF)

      mark_as_advanced ("HDF5_VOL_${hdf5_vol_name_upper}_NAME")
      mark_as_advanced ("HDF5_VOL_${hdf5_vol_name_upper}_TEST_PARALLEL")

      if (HDF5_TEST_API)
        if ("${HDF5_VOL_${hdf5_vol_name_upper}_NAME}" STREQUAL "")
          message (SEND_ERROR "HDF5_VOL_${hdf5_vol_name_upper}_NAME must be set to a valid connector name to use VOL connector '${hdf5_vol_name}' for testing")
        endif ()
      endif ()

      if ((HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT") AND ("${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}" STREQUAL ""))
        message (SEND_ERROR "HDF5_VOL_${hdf5_vol_name_upper}_BRANCH must be set to a valid git branch name (or git tag) to build VOL connector '${hdf5_vol_name}'")
      endif ()

      if ((HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
        AND NOT (EXISTS ${HDF5_VOL_SOURCE} AND IS_DIRECTORY ${HDF5_VOL_SOURCE}))
          message (FATAL_ERROR "HDF5_VOL_PATH${vol_idx_fixed} must be an absolute path to a valid directory")
      endif ()

      # Set internal convenience variables for FetchContent dependency name
      set (hdf5_vol_depname "${HDF5_VOL_${hdf5_vol_name_upper}_CMAKE_PACKAGE_NAME}")
      string (TOLOWER "${hdf5_vol_depname}" hdf5_vol_depname_lower)

      if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24")
        set("OVERRIDE_FIND_PACKAGE_OPT" "OVERRIDE_FIND_PACKAGE")
      endif()

      if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
        FetchContent_Declare (${hdf5_vol_depname}
            GIT_REPOSITORY "${HDF5_VOL_SOURCE}"
            GIT_TAG "${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}"
            "${OVERRIDE_FIND_PACKAGE_OPT}"
        )
      elseif(HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
        FetchContent_Declare (${hdf5_vol_depname}
          SOURCE_DIR "${HDF5_VOL_SOURCE}"
        )
      endif()

      FetchContent_GetProperties(${hdf5_vol_depname})
      if (NOT ${hdf5_vol_depname}_POPULATED)
        FetchContent_Populate(${hdf5_vol_depname})

        # Now that content has been populated, set other internal
        # convenience variables for FetchContent dependency
        set (hdf5_vol_depname_source_dir "${${hdf5_vol_depname_lower}_SOURCE_DIR}")
        set (hdf5_vol_depname_binary_dir "${${hdf5_vol_depname_lower}_BINARY_DIR}")

        if (NOT EXISTS "${hdf5_vol_depname_source_dir}/CMakeLists.txt")
          if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
            message (SEND_ERROR "The git repository branch '${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}' for VOL connector '${hdf5_vol_name}' does not appear to contain a CMakeLists.txt file")
          elseif (HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
            message(SEND_ERROR "The local directory '${HDF5_VOL_SOURCE}' for VOL connector '${hdf5_vol_name}' does not appear to contain a CMakeLists.txt file")
          endif()
        endif ()

        # If there are any calls to find_package(HDF5) in the connector's
        # CMakeLists.txt files, remove those since any found HDF5 targets
        # will conflict with targets being generated by this build of HDF5
        if (EXISTS "${hdf5_vol_depname_source_dir}/CMakeLists.txt")
          file (READ "${hdf5_vol_depname_source_dir}/CMakeLists.txt" vol_cmake_contents)
          string (REGEX REPLACE "[ \t]*find_package[ \t]*\\([ \t]*HDF5[^\r\n\\)]*\\)[ \t]*[\r\n]+" "" vol_cmake_contents "${vol_cmake_contents}")
          file (WRITE "${hdf5_vol_depname_source_dir}/CMakeLists.txt" "${vol_cmake_contents}")
        endif ()
        if (EXISTS "${hdf5_vol_depname_source_dir}/src/CMakeLists.txt")
          file (READ "${hdf5_vol_depname_source_dir}/src/CMakeLists.txt" vol_cmake_contents)
          string (REGEX REPLACE "[ \t]*find_package[ \t]*\\([ \t]*HDF5[^\r\n\\)]*\\)[ \t]*[\r\n]+" "" vol_cmake_contents "${vol_cmake_contents}")

InsightSoftwareConsortium/ITK Modules/ThirdParty/HDF5/src/itkhdf5/CMakeVOL.cmake :51

        string (REGEX REPLACE "^[ \t]*set_tests_properties\\([ \t]*[\r\n]?" "" stripped_line "${line}")
      endif ()
      string (REGEX MATCH "^[ \t]*.\\{test\\}[ \t]*[\r\n]?" match_string "${line}")
      if (NOT "${match_string}" STREQUAL "")
        string (REGEX REPLACE "^[ \t]*.\\{[A-Za-z]*\\}[ \t]*[\r\n]?" "" stripped_line "${line}")
      endif ()
      string (REGEX MATCH "^[ \t]*PROPERTIES[ \t]*[\r\n]?" match_string "${line}")
      if (NOT "${match_string}" STREQUAL "")
        string (REGEX REPLACE "^[ \t]*PROPERTIES[ \t]*[\r\n]?" "" stripped_line "${line}")
      endif ()
      string (REGEX MATCH "^[ \t]*ENVIRONMENT[ \t]*.*[\r\n]?" match_string "${line}")
      if (NOT "${match_string}" STREQUAL "")
        string (REGEX REPLACE "^[ \t]*ENVIRONMENT[ \t]*.*[\r\n]?" "" stripped_line "${line}")
      endif ()
      file (APPEND "${source_dir}/tests/CMakeLists.txt" "${stripped_line}\n")
    endforeach ()
  endif ()
endfunction ()

set (HDF5_VOL_ALLOW_EXTERNAL "NO" CACHE STRING "Allow building of external HDF5 VOL connectors with FetchContent")
set_property (CACHE HDF5_VOL_ALLOW_EXTERNAL PROPERTY STRINGS NO GIT LOCAL_DIR)
mark_as_advanced (HDF5_VOL_ALLOW_EXTERNAL)
if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT" OR HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
  # For compatibility, set some variables that projects would
  # typically look for after calling find_package(HDF5)
  set (HDF5_FOUND 1)
  set (HDF5_LIBRARIES "${HDF5_LIBSH_TARGET};${LINK_LIBS};${LINK_COMP_LIBS};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPI::MPI_C>")
  set (HDF5_INCLUDE_DIRS "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
  set (HDF5_IS_PARALLEL ${H5_HAVE_PARALLEL})
  set (HDF5_VERSION ${HDF5_PACKAGE_VERSION})

  set (HDF5_C_LIBRARIES "${HDF5_LIBRARIES}")

  if (HDF5_BUILD_HL_LIB)
    set (HDF5_C_HL_LIBRARIES "${HDF5_HL_LIBSH_TARGET}")
  endif()

  set (HDF5_MAX_EXTERNAL_VOLS 10)
  set (HDF5_EXTERNAL_VOL_TARGETS "")

  foreach (vol_idx RANGE 1 ${HDF5_MAX_EXTERNAL_VOLS})
    # Generate fixed-width index number prepended with 0s
    # so VOL sources come in order from 1 - HDF5_MAX_EXTERNAL_VOLS
    set (vol_idx_num_digits 2) # Based on HDF5_MAX_EXTERNAL_VOLS
    set (vol_idx_fixed "${vol_idx}")
    string (LENGTH "${vol_idx_fixed}" vol_idx_len)
    while (vol_idx_len LESS vol_idx_num_digits)
      string (PREPEND vol_idx_fixed "0")
      math (EXPR vol_idx_len "${vol_idx_len}+1")
    endwhile ()

    if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
      set (HDF5_VOL_URL${vol_idx_fixed} "" CACHE STRING "Git repository URL of an external HDF5 VOL connector to build")
      mark_as_advanced (HDF5_VOL_URL${vol_idx_fixed})
      set (HDF5_VOL_SOURCE "${HDF5_VOL_URL${vol_idx_fixed}}")
    elseif(HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
      set (HDF5_VOL_PATH${vol_idx_fixed} "" CACHE STRING "Path to the source directory of an external HDF5 VOL connector to build")
      mark_as_advanced (HDF5_VOL_PATH${vol_idx_fixed})
      set (HDF5_VOL_SOURCE "${HDF5_VOL_PATH${vol_idx_fixed}}")
    endif()

    if (NOT "${HDF5_VOL_SOURCE}" STREQUAL "")
      # Deal with trailing slash in path for LOCAL_DIR case
      if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
        # Erase trailing slash
        string (REGEX REPLACE "/$" "" HDF5_VOL_SOURCE ${HDF5_VOL_SOURCE})
      endif()

      # Extract the name of the VOL connector
      string (FIND "${HDF5_VOL_SOURCE}" "/" hdf5_vol_name_pos REVERSE)
      if (hdf5_vol_name_pos EQUAL -1)
        if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
          message (SEND_ERROR "Invalid URL '${HDF5_VOL_SOURCE}' specified for HDF5_VOL_URL${vol_idx_fixed}")
        elseif (HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
          message (SEND_ERROR "Invalid source path '${HDF5_VOL_SOURCE}' specified for HDF5_VOL_PATH${vol_idx_fixed}")
        endif()
      endif ()

      math (EXPR hdf5_vol_name_pos "${hdf5_vol_name_pos}+1")

      string (SUBSTRING "${HDF5_VOL_SOURCE}" ${hdf5_vol_name_pos} -1 hdf5_vol_name)
      string (REPLACE ".git" "" hdf5_vol_name "${hdf5_vol_name}")
      string (STRIP "${hdf5_vol_name}" hdf5_vol_name)
      string (TOUPPER "${hdf5_vol_name}" hdf5_vol_name_upper)
      string (TOLOWER "${hdf5_vol_name}" hdf5_vol_name_lower)

      message (VERBOSE "Building VOL connector '${hdf5_vol_name}' with FetchContent from source ${HDF5_VOL_SOURCE}")

      # Set some cache variables that can be set by users when building
      if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
        set ("HDF5_VOL_${hdf5_vol_name_upper}_BRANCH" "main" CACHE STRING "Git branch (or tag) to use when building VOL connector '${hdf5_vol_name}'")
        mark_as_advanced ("HDF5_VOL_${hdf5_vol_name_upper}_BRANCH")
      endif()

      set ("HDF5_VOL_${hdf5_vol_name_upper}_CMAKE_PACKAGE_NAME"
        "${hdf5_vol_name_lower}"
        CACHE
        STRING
        "CMake package name used by find_package(...) calls for VOL connector '${hdf5_vol_name}'"
      )

      set ("HDF5_VOL_${hdf5_vol_name_upper}_NAME" "" CACHE STRING "Name of VOL connector to set for the HDF5_VOL_CONNECTOR environment variable")
      option ("HDF5_VOL_${hdf5_vol_name_upper}_TEST_PARALLEL" "Whether to test VOL connector '${hdf5_vol_name}' against the parallel API tests" OFF)

      mark_as_advanced ("HDF5_VOL_${hdf5_vol_name_upper}_NAME")
      mark_as_advanced ("HDF5_VOL_${hdf5_vol_name_upper}_TEST_PARALLEL")

      if (HDF5_TEST_API)
        if ("${HDF5_VOL_${hdf5_vol_name_upper}_NAME}" STREQUAL "")
          message (SEND_ERROR "HDF5_VOL_${hdf5_vol_name_upper}_NAME must be set to a valid connector name to use VOL connector '${hdf5_vol_name}' for testing")
        endif ()
      endif ()

      if ((HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT") AND ("${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}" STREQUAL ""))
        message (SEND_ERROR "HDF5_VOL_${hdf5_vol_name_upper}_BRANCH must be set to a valid git branch name (or git tag) to build VOL connector '${hdf5_vol_name}'")
      endif ()

      if ((HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
        AND NOT (EXISTS ${HDF5_VOL_SOURCE} AND IS_DIRECTORY ${HDF5_VOL_SOURCE}))
          message (FATAL_ERROR "HDF5_VOL_PATH${vol_idx_fixed} must be an absolute path to a valid directory")
      endif ()

      # Set internal convenience variables for FetchContent dependency name
      set (hdf5_vol_depname "${HDF5_VOL_${hdf5_vol_name_upper}_CMAKE_PACKAGE_NAME}")
      string (TOLOWER "${hdf5_vol_depname}" hdf5_vol_depname_lower)

      if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24")
        set("OVERRIDE_FIND_PACKAGE_OPT" "OVERRIDE_FIND_PACKAGE")
      endif()

      if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
        FetchContent_Declare (${hdf5_vol_depname}
            GIT_REPOSITORY "${HDF5_VOL_SOURCE}"
            GIT_TAG "${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}"
            "${OVERRIDE_FIND_PACKAGE_OPT}"
        )
      elseif(HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
        FetchContent_Declare (${hdf5_vol_depname}
          SOURCE_DIR "${HDF5_VOL_SOURCE}"
        )
      endif()

      FetchContent_GetProperties(${hdf5_vol_depname})
      if (NOT ${hdf5_vol_depname}_POPULATED)
        FetchContent_Populate(${hdf5_vol_depname})

        # Now that content has been populated, set other internal
        # convenience variables for FetchContent dependency
        set (hdf5_vol_depname_source_dir "${${hdf5_vol_depname_lower}_SOURCE_DIR}")
        set (hdf5_vol_depname_binary_dir "${${hdf5_vol_depname_lower}_BINARY_DIR}")

        if (NOT EXISTS "${hdf5_vol_depname_source_dir}/CMakeLists.txt")
          if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT")
            message (SEND_ERROR "The git repository branch '${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}' for VOL connector '${hdf5_vol_name}' does not appear to contain a CMakeLists.txt file")
          elseif (HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")
            message(SEND_ERROR "The local directory '${HDF5_VOL_SOURCE}' for VOL connector '${hdf5_vol_name}' does not appear to contain a CMakeLists.txt file")
          endif()
        endif ()

        # If there are any calls to find_package(HDF5) in the connector's
        # CMakeLists.txt files, remove those since any found HDF5 targets
        # will conflict with targets being generated by this build of HDF5
        if (EXISTS "${hdf5_vol_depname_source_dir}/CMakeLists.txt")
          file (READ "${hdf5_vol_depname_source_dir}/CMakeLists.txt" vol_cmake_contents)
          string (REGEX REPLACE "[ \t]*find_package[ \t]*\\([ \t]*HDF5[^\r\n\\)]*\\)[ \t]*[\r\n]+" "" vol_cmake_contents "${vol_cmake_contents}")

InsightSoftwareConsortium/ITK Modules/ThirdParty/HDF5/src/itkhdf5/CMakeVOL.cmake :96

string (LENGTH "${vol_idx_fixed}" vol_idx_len)

InsightSoftwareConsortium/ITK Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/fileCompareTest.cmake :39

string (LENGTH ${TEST_ONE_STRING} TEST_ONE_STRING_LEN)

InsightSoftwareConsortium/ITK Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/UseJava.cmake :799

string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN)

InsightSoftwareConsortium/ITK Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/userblockTest.cmake :50

string (LENGTH ${TEST_U_STRING} TEST_U_STRING_LEN)

InsightSoftwareConsortium/ITK Utilities/Doxygen/GenerateExamplesDox.cmake :29

string(LENGTH "${PROJECT_SOURCE_DIR}/" root_length)

lammps/lammps cmake/Modules/LAMMPSUtils.cmake :77

string(LENGTH ${month} month_length)

lammps/lammps cmake/Modules/LAMMPSUtils.cmake :159

string(RANDOM LENGTH 10 TMP_EXT)

lexbor/lexbor config.cmake :84

STRING(LENGTH "${tmp}" str_len)

analogdevicesinc/libiio cmake/CheckCaseSensitiveFileSystem.cmake :13

string(RANDOM LENGTH 6 ALPHABET abcdefghijklmnopqrstuvwxyz TMP_FILE_L)

sbmlteam/libsbml src/bindings/csharp/CMakeLists.txt :241

string(LENGTH "${LIBSBML_CSHARP_BINDING_NATIVE_LIBRARY_NAME}" length)

libsndfile/libsndfile cmake/CMakeAutoGenScript.cmake :89

string(LENGTH "${MATCH_GROUP}" MATCH_LENGTH)

libsndfile/libsndfile cmake/CMakeAutoGenScript.cmake :109

string(LENGTH "${TEXT_APPEND}" TEXT_LENGTH)

libsndfile/libsndfile cmake/CMakeAutoGenScript.cmake :262

string(RANDOM LENGTH 64 RANDOMSTRING)

webmproject/libwebp CMakeLists.txt :444

string(REGEX MATCH "AC_INIT\\([^\n]*\\[[0-9\\.]+\\]" TMP ${CONFIGURE_FILE})
string(REGEX MATCH "[0-9\\.]+" PROJECT_VERSION ${TMP})

# Define the libraries to install.
list(APPEND INSTALLED_LIBRARIES webpdecoder webp webpdemux)

# Deal with SIMD. Change the compile flags for SIMD files we use.
list(LENGTH WEBP_SIMD_FILES_TO_INCLUDE WEBP_SIMD_FILES_TO_INCLUDE_LENGTH)
math(EXPR WEBP_SIMD_FILES_TO_INCLUDE_RANGE
     "${WEBP_SIMD_FILES_TO_INCLUDE_LENGTH}-1")

foreach(I_FILE RANGE ${WEBP_SIMD_FILES_TO_INCLUDE_RANGE})
  list(GET WEBP_SIMD_FILES_TO_INCLUDE ${I_FILE} FILE)
  list(GET WEBP_SIMD_FLAGS_TO_INCLUDE ${I_FILE} SIMD_COMPILE_FLAG)
  set_source_files_properties(${FILE} PROPERTIES COMPILE_FLAGS
                                                 ${SIMD_COMPILE_FLAG})
endforeach()

if(NOT WEBP_BUILD_LIBWEBPMUX)
  set(WEBP_BUILD_GIF2WEBP OFF)
  set(WEBP_BUILD_IMG2WEBP OFF)
  set(WEBP_BUILD_WEBPMUX OFF)
endif()

if(WEBP_BUILD_GIF2WEBP AND NOT GIF_FOUND)
  set(WEBP_BUILD_GIF2WEBP OFF)
endif()

if(WEBP_BUILD_ANIM_UTILS AND NOT GIF_FOUND)
  set(WEBP_BUILD_ANIM_UTILS OFF)
endif()

# Build the executables if asked for.
if(WEBP_BUILD_ANIM_UTILS
   OR WEBP_BUILD_CWEBP
   OR WEBP_BUILD_DWEBP
   OR WEBP_BUILD_EXTRAS
   OR WEBP_BUILD_FUZZTEST
   OR WEBP_BUILD_GIF2WEBP
   OR WEBP_BUILD_IMG2WEBP
   OR WEBP_BUILD_VWEBP
   OR WEBP_BUILD_WEBPMUX
   OR WEBP_BUILD_WEBPINFO)
  # Example utility library.
  parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "EXAMPLEUTIL_SRCS"
                    "example_util_[^ ]*")
  list(APPEND EXAMPLEUTIL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/examples/stopwatch.h)
  add_library(exampleutil STATIC ${EXAMPLEUTIL_SRCS})
  target_include_directories(
    exampleutil PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)

  parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEIOUTILS_SRCS"
                    "imageio_util_[^ ]*")
  add_library(imageioutil STATIC ${IMAGEIOUTILS_SRCS})
  target_link_libraries(imageioutil webp)
  target_link_libraries(exampleutil imageioutil)

  # Image-decoding utility library.
  parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEDEC_SRCS"
                    "imagedec_[^ ]*")
  add_library(imagedec STATIC ${IMAGEDEC_SRCS})
  target_link_libraries(imagedec imageioutil webpdemux webp
                        ${WEBP_DEP_IMG_LIBRARIES})

  # Image-encoding utility library.
  parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/imageio "IMAGEENC_SRCS"
                    "imageenc_[^ ]*")
  add_library(imageenc STATIC ${IMAGEENC_SRCS})
  target_link_libraries(imageenc imageioutil webp)

  set_property(
    TARGET exampleutil imageioutil imagedec imageenc
    PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/src
             ${CMAKE_CURRENT_BINARY_DIR}/src)
  target_include_directories(imagedec PRIVATE ${WEBP_DEP_IMG_INCLUDE_DIRS})
  target_include_directories(imageenc PRIVATE ${WEBP_DEP_IMG_INCLUDE_DIRS})
endif()

if(WEBP_BUILD_DWEBP)
  # dwebp
  parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "DWEBP_SRCS" "dwebp")
  add_executable(dwebp ${DWEBP_SRCS})
  target_link_libraries(dwebp exampleutil imagedec imageenc)
  target_include_directories(dwebp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
  install(TARGETS dwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

if(WEBP_BUILD_CWEBP)
  # cwebp
  parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "CWEBP_SRCS" "cwebp")
  add_executable(cwebp ${CWEBP_SRCS})
  target_link_libraries(cwebp exampleutil imagedec webp)
  target_include_directories(cwebp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src
                                           ${CMAKE_CURRENT_SOURCE_DIR})
  install(TARGETS cwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

if(WEBP_BUILD_LIBWEBPMUX)
  parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/src/mux "WEBP_MUX_SRCS" "")
  add_library(libwebpmux ${WEBP_MUX_SRCS})
  target_link_libraries(libwebpmux webp)
  target_include_directories(libwebpmux PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
                                                ${CMAKE_CURRENT_SOURCE_DIR})
  set_version(src/mux/Makefile.am libwebpmux webpmux)
  set_target_properties(
    libwebpmux
    PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux.h;\
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux_types.h;\
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/types.h;")
  set_target_properties(libwebpmux PROPERTIES OUTPUT_NAME webpmux)
  list(APPEND INSTALLED_LIBRARIES libwebpmux)
  configure_pkg_config("src/mux/libwebpmux.pc")
endif()

if(WEBP_BUILD_GIF2WEBP)
  # gif2webp
  include_directories(${WEBP_DEP_GIF_INCLUDE_DIRS})
  parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "GIF2WEBP_SRCS"
                    "gif2webp")
  add_executable(gif2webp ${GIF2WEBP_SRCS})
  target_link_libraries(gif2webp exampleutil imageioutil webp libwebpmux
                        ${WEBP_DEP_GIF_LIBRARIES})
  target_include_directories(gif2webp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src
                                              ${CMAKE_CURRENT_SOURCE_DIR})
  install(TARGETS gif2webp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

if(WEBP_BUILD_IMG2WEBP)
  # img2webp
  include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS})
  parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "IMG2WEBP_SRCS"
                    "img2webp")
  add_executable(img2webp ${IMG2WEBP_SRCS})
  target_link_libraries(img2webp exampleutil imagedec imageioutil webp
                        libwebpmux)
  target_include_directories(img2webp PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src
                                              ${CMAKE_CURRENT_SOURCE_DIR})
  install(TARGETS img2webp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

if(WEBP_BUILD_VWEBP)
  # vwebp
  find_package(GLUT)
  if(GLUT_FOUND)
    include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS})
    parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "VWEBP_SRCS" "vwebp")
    add_executable(vwebp ${VWEBP_SRCS})
    target_link_libraries(
      vwebp
      ${OPENGL_LIBRARIES}
      exampleutil
      GLUT::GLUT
      imageioutil
      webp
      webpdemux)
    target_include_directories(
      vwebp PRIVATE ${GLUT_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src
                    ${OPENGL_INCLUDE_DIR})
    install(TARGETS vwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
    if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
      check_c_compiler_flag("-Wno-deprecated-declarations" HAS_NO_DEPRECATED)
      if(HAS_NO_DEPRECATED)
        target_compile_options(vwebp PRIVATE "-Wno-deprecated-declarations")
      endif()
    endif()
  endif()
endif()

if(WEBP_BUILD_WEBPINFO)
  # webpinfo
  include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS})
  parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "WEBPINFO_SRCS"
                    "webpinfo")
  add_executable(webpinfo ${WEBPINFO_SRCS})
  target_link_libraries(webpinfo exampleutil imageioutil)
  target_include_directories(webpinfo PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src
                                              ${CMAKE_CURRENT_SOURCE_DIR}/src)
  install(TARGETS webpinfo RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

if(WEBP_BUILD_WEBPMUX)
  # webpmux
  parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "WEBPMUX_SRCS"
                    "webpmux")
  add_executable(webpmux ${WEBPMUX_SRCS})
  target_link_libraries(webpmux exampleutil imageioutil libwebpmux webp)
  target_include_directories(webpmux PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
  install(TARGETS webpmux RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

if(WEBP_BUILD_EXTRAS)
  set(EXTRAS_MAKEFILE "${CMAKE_CURRENT_SOURCE_DIR}/extras")
  parse_makefile_am(${EXTRAS_MAKEFILE} "WEBP_EXTRAS_SRCS" "libwebpextras_la")
  parse_makefile_am(${EXTRAS_MAKEFILE} "GET_DISTO_SRCS" "get_disto")
  parse_makefile_am(${EXTRAS_MAKEFILE} "WEBP_QUALITY_SRCS" "webp_quality")
  parse_makefile_am(${EXTRAS_MAKEFILE} "VWEBP_SDL_SRCS" "vwebp_sdl")

  # libextras
  add_library(extras STATIC ${WEBP_EXTRAS_SRCS})
  target_include_directories(
    extras PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
                   ${CMAKE_CURRENT_SOURCE_DIR}/src)

  # get_disto
  add_executable(get_disto ${GET_DISTO_SRCS})
  target_link_libraries(get_disto imagedec)
  target_include_directories(get_disto PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
                                               ${CMAKE_CURRENT_BINARY_DIR}/src)

  # webp_quality
  add_executable(webp_quality ${WEBP_QUALITY_SRCS})
  target_link_libraries(webp_quality exampleutil imagedec extras)
  target_include_directories(webp_quality PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
                                                  ${CMAKE_CURRENT_BINARY_DIR})

  # vwebp_sdl
  find_package(SDL2 QUIET)
  if(WEBP_BUILD_VWEBP AND SDL2_FOUND)
    add_executable(vwebp_sdl ${VWEBP_SDL_SRCS})
    target_link_libraries(vwebp_sdl ${SDL2_LIBRARIES} imageioutil webp)
    target_include_directories(
      vwebp_sdl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
                        ${CMAKE_CURRENT_BINARY_DIR}/src ${SDL2_INCLUDE_DIRS})
    set(WEBP_HAVE_SDL 1)
    target_compile_definitions(vwebp_sdl PUBLIC WEBP_HAVE_SDL)

    set(CMAKE_REQUIRED_INCLUDES "${SDL2_INCLUDE_DIRS}")
    check_c_source_compiles(
      "
        #define SDL_MAIN_HANDLED
        #include \"SDL.h\"
        int main(void) {
          return 0;
        }
      "
      HAVE_JUST_SDL_H)
    set(CMAKE_REQUIRED_INCLUDES)
    if(HAVE_JUST_SDL_H)
      target_compile_definitions(vwebp_sdl PRIVATE WEBP_HAVE_JUST_SDL_H)
    endif()
  endif()
endif()

if(WEBP_BUILD_WEBP_JS)
  # The default stack size changed from 5MB to 64KB in 3.1.27. See
  # https://crbug.com/webp/614.
  if(EMSCRIPTEN_VERSION VERSION_GREATER_EQUAL "3.1.27")
    # TOTAL_STACK size was renamed to STACK_SIZE in 3.1.27. The old name was
    # kept for compatibility, but prefer the new one in case it is removed in
    # the future.
    set(emscripten_stack_size "-sSTACK_SIZE=5MB")
  else()
    set(emscripten_stack_size "-sTOTAL_STACK=5MB")
  endif()
  find_package(SDL2 REQUIRED)
  # wasm2js does not support SIMD.
  if(NOT WEBP_ENABLE_SIMD)
    # JavaScript version
    add_executable(webp_js ${CMAKE_CURRENT_SOURCE_DIR}/extras/webp_to_sdl.c)
    target_link_libraries(webp_js webpdecoder SDL2)
    target_include_directories(webp_js PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
    set(WEBP_HAVE_SDL 1)
    set_target_properties(
      webp_js
      PROPERTIES
        # Emscripten puts -sUSE_SDL2=1 in this variable, though it's needed at
        # compile time to ensure the headers are downloaded.
        COMPILE_OPTIONS "${SDL2_LIBRARIES}"
        LINK_FLAGS
        "-sWASM=0 ${emscripten_stack_size} \
         -sEXPORTED_FUNCTIONS=_WebPToSDL -sINVOKE_RUN=0 \
         -sEXPORTED_RUNTIME_METHODS=cwrap ${SDL2_LIBRARIES} \
         -sALLOW_MEMORY_GROWTH")
    set_target_properties(webp_js PROPERTIES OUTPUT_NAME webp)
    target_compile_definitions(webp_js PUBLIC EMSCRIPTEN WEBP_HAVE_SDL)
  endif()

  # WASM version
  add_executable(webp_wasm ${CMAKE_CURRENT_SOURCE_DIR}/extras/webp_to_sdl.c)
  target_link_libraries(webp_wasm webpdecoder SDL2)
  target_include_directories(webp_wasm PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
  set_target_properties(
    webp_wasm
    PROPERTIES
      # Emscripten puts -sUSE_SDL2=1 in this variable, though it's needed at
      # compile time to ensure the headers are downloaded.
      COMPILE_OPTIONS "${SDL2_LIBRARIES}"
      LINK_FLAGS
      "-sWASM=1 ${emscripten_stack_size} \
       -sEXPORTED_FUNCTIONS=_WebPToSDL -sINVOKE_RUN=0 \
       -sEXPORTED_RUNTIME_METHODS=cwrap ${SDL2_LIBRARIES} \
       -sALLOW_MEMORY_GROWTH")
  target_compile_definitions(webp_wasm PUBLIC EMSCRIPTEN WEBP_HAVE_SDL)

  target_compile_definitions(webpdspdecode PUBLIC EMSCRIPTEN)
endif()

if(WEBP_BUILD_ANIM_UTILS)
  # anim_diff
  include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS} ${WEBP_DEP_GIF_INCLUDE_DIRS})
  parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "ANIM_DIFF_SRCS"
                    "anim_diff")
  add_executable(anim_diff ${ANIM_DIFF_SRCS})
  target_link_libraries(
    anim_diff
    exampleutil
    imagedec
    imageenc
    imageioutil
    webp
    webpdemux
    ${WEBP_DEP_GIF_LIBRARIES})
  target_include_directories(anim_diff PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)

  # anim_dump
  include_directories(${WEBP_DEP_IMG_INCLUDE_DIRS} ${WEBP_DEP_GIF_INCLUDE_DIRS})
  parse_makefile_am(${CMAKE_CURRENT_SOURCE_DIR}/examples "ANIM_DUMP_SRCS"
                    "anim_dump")
  add_executable(anim_dump ${ANIM_DUMP_SRCS})
  target_link_libraries(
    anim_dump
    exampleutil
    imagedec
    imageenc
    imageioutil
    webp
    webpdemux
    ${WEBP_DEP_GIF_LIBRARIES})
  target_include_directories(anim_dump PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src)
endif()

if(WEBP_BUILD_FUZZTEST)
  add_subdirectory(tests/fuzzer)
endif()

# Install the different headers and libraries.
install(
  TARGETS ${INSTALLED_LIBRARIES}
  EXPORT ${PROJECT_NAME}Targets
  PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/webp
  INCLUDES
  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
set(ConfigPackageLocation ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake/)
install(EXPORT ${PROJECT_NAME}Targets NAMESPACE ${PROJECT_NAME}::
        DESTINATION ${ConfigPackageLocation})

# Create the CMake version file.
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
  "${CMAKE_CURRENT_BINARY_DIR}/WebPConfigVersion.cmake"
  VERSION ${PACKAGE_VERSION} COMPATIBILITY AnyNewerVersion)

# Create the Config file.
include(CMakePackageConfigHelpers)
# Fix libwebpmux reference. The target name libwebpmux is used for compatibility
# purposes, but the library mentioned in WebPConfig.cmake should be the
# unprefixed version. Note string(...) can be replaced with list(TRANSFORM ...)
# if cmake_minimum_required is >= 3.12.
string(REGEX REPLACE "libwebpmux" "webpmux" INSTALLED_LIBRARIES
                     "${INSTALLED_LIBRARIES}")

if(MSVC)
  # For compatibility with nmake, MSVC builds use a custom prefix (lib) that
  # needs to be included in the library name.
  string(REGEX REPLACE "[A-Za-z0-9_]+" "${CMAKE_STATIC_LIBRARY_PREFIX}\\0"
                       INSTALLED_LIBRARIES "${INSTALLED_LIBRARIES}")
endif()

configure_package_config_file(
  ${CMAKE_CURRENT_SOURCE_DIR}/cmake/WebPConfig.cmake.in
  ${CMAKE_CURRENT_BINARY_DIR}/WebPConfig.cmake
  INSTALL_DESTINATION ${ConfigPackageLocation}
  PATH_VARS CMAKE_INSTALL_INCLUDEDIR)

# Install the generated CMake files.
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/WebPConfigVersion.cmake"
              "${CMAKE_CURRENT_BINARY_DIR}/WebPConfig.cmake"
        DESTINATION ${ConfigPackageLocation})

# Install the man pages.
set(MAN_PAGES
    cwebp.1
    dwebp.1
    gif2webp.1
    img2webp.1
    vwebp.1
    webpmux.1
    webpinfo.1)
set(EXEC_BUILDS
    "CWEBP"
    "DWEBP"
    "GIF2WEBP"
    "IMG2WEBP"
    "VWEBP"
    "WEBPMUX"
    "WEBPINFO")
list(LENGTH MAN_PAGES MAN_PAGES_LENGTH)
math(EXPR MAN_PAGES_RANGE "${MAN_PAGES_LENGTH} - 1")

foreach(I_MAN RANGE ${MAN_PAGES_RANGE})
  list(GET EXEC_BUILDS ${I_MAN} EXEC_BUILD)
  if(WEBP_BUILD_${EXEC_BUILD})
    list(GET MAN_PAGES ${I_MAN} MAN_PAGE)
    install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/man/${MAN_PAGE}
            DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc)
  endif()
endforeach()

luvit/luv deps/lua.cmake :134

string(LENGTH ${CMAKE_SOURCE_DIR} _luajit_source_dir_length)

tpaviot/oce adm/cmake/cotire.cmake :1007

string (LENGTH "${${_relPathVar}}" _closestLen)

tpaviot/oce adm/cmake/cotire.cmake :1028

string (LENGTH "${_insideRelPath}" _insideRelPathLen)

tpaviot/oce adm/cmake/cotire.cmake :1079

string (LENGTH "${CMAKE_MATCH_1}" ${_headerDepthVar})

wgois/OIS CMakeModules/FindWindowsSDK.cmake :502

string(LENGTH "${_sdkdir}" _sdklen)

opencv/opencv 3rdparty/libjpeg-turbo/CMakeLists.txt :28

string(LENGTH "${${NUMBER}}" INPUT_LEN)

opencv/opencv cmake/OpenCVUtils.cmake :275

string(LENGTH "${dir}" len)

opencv/opencv cmake/OpenCVUtils.cmake :1015

string(RANDOM LENGTH ${status_placeholder_length} ALPHABET " " status_placeholder)

opencv/opencv cmake/OpenCVUtils.cmake :1016

string(LENGTH "${text}" status_text_length)

opencv/opencv samples/semihosting/include/CMakeLists.txt :8

string(RANDOM LENGTH 8 ALPHABET 0123456789abcdf RANDOM_SEED 314 number)

opencv/opencv samples/semihosting/include/CMakeLists.txt :12

string(RANDOM LENGTH 8 ALPHABET 0123456789abcdf number)

raspberrypi/picotool cmake/binh.cmake :2

string(LENGTH ${FILE_CONTENT} FILE_CONTENT_LENGTH)

podofo/podofo test/common/cmake/ParseAndAddCatchTests.cmake :137

        string(REGEX MATCH "(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^,^\"]*" TestTypeAndFixture "${TestName}")
        string(REGEX MATCH "(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)" TestType "${TestTypeAndFixture}")
        string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")

        # Get string parts of test definition
        string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")

        # Strip wrapping quotation marks
        string(REGEX REPLACE "^\"(.*)\"$" "\\1" TestStrings "${TestStrings}")
        string(REPLACE "\";\"" ";" TestStrings "${TestStrings}")

        # Validate that a test name and tags have been provided
        list(LENGTH TestStrings TestStringsLength)
        if(TestStringsLength GREATER 2 OR TestStringsLength LESS 1)
            message(FATAL_ERROR "You must provide a valid test name and tags for all tests in ${SourceFile}")
        endif()

        # Assign name and tags
        list(GET TestStrings 0 Name)
        if("${TestType}" STREQUAL "SCENARIO")
            set(Name "Scenario: ${Name}")
        endif()
        if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND "${TestType}" MATCHES "(CATCH_)?TEST_CASE_METHOD" AND TestFixture )
            set(CTestName "${TestFixture}:${Name}")
        else()
            set(CTestName "${Name}")
        endif()
        if(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME)
            set(CTestName "${TestTarget}:${CTestName}")
        endif()
        # add target to labels to enable running all tests added from this target
        set(Labels ${TestTarget})
        if(TestStringsLength EQUAL 2)
            list(GET TestStrings 1 Tags)
            string(TOLOWER "${Tags}" Tags)
            # remove target from labels if the test is hidden
            if("${Tags}" MATCHES ".*\\[!?(hide|\\.)\\].*")
                list(REMOVE_ITEM Labels ${TestTarget})
            endif()
            string(REPLACE "]" ";" Tags "${Tags}")
            string(REPLACE "[" "" Tags "${Tags}")
        else()
          # unset tags variable from previous loop
          unset(Tags)
        endif()

        list(APPEND Labels ${Tags})

        set(HiddenTagFound OFF)
        foreach(label ${Labels})
            string(REGEX MATCH "^!hide|^\\." result ${label})
            if(result)
                set(HiddenTagFound ON)
                break()
            endif(result)
        endforeach(label)
        if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_LESS "3.9")
            ParseAndAddCatchTests_PrintDebugMessage("Skipping test \"${CTestName}\" as it has [!hide], [.] or [.foo] label")
        else()
            ParseAndAddCatchTests_PrintDebugMessage("Adding test \"${CTestName}\"")
            if(Labels)
                ParseAndAddCatchTests_PrintDebugMessage("Setting labels to ${Labels}")
            endif()

            # Escape commas in the test spec
            string(REPLACE "," "\\," Name ${Name})

            # Work around CMake 3.18.0 change in `add_test()`, before the escaped quotes were necessary,
            # only with CMake 3.18.0 the escaped double quotes confuse the call. This change is reverted in 3.18.1
            # And properly introduced in 3.19 with the CMP0110 policy
            if(_cmp0110_value STREQUAL "NEW" OR ${CMAKE_VERSION} VERSION_EQUAL "3.18")
                ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to NEW, no need for add_test(\"\") workaround")
            else()
                ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to OLD adding \"\" for add_test() workaround")
                set(CTestName "\"${CTestName}\"")
            endif()

            # Handle template test cases
            if("${TestTypeAndFixture}" MATCHES ".*TEMPLATE_.*")
              set(Name "${Name} - *")
            endif()

            # Add the test and set its properties
            add_test(NAME "${CTestName}" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
            # Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead
            if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
                ParseAndAddCatchTests_PrintDebugMessage("Setting DISABLED test property")
                set_tests_properties("${CTestName}" PROPERTIES DISABLED ON)
            else()
                set_tests_properties("${CTestName}" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
                                                        LABELS "${Labels}")
            endif()
            set_property(
              TARGET ${TestTarget}
              APPEND
              PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
            set_property(
              SOURCE ${SourceFile}
              APPEND
              PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
        endif()


    endforeach()
endfunction()

# entry point
function(ParseAndAddCatchTests TestTarget)
    message(DEPRECATION "ParseAndAddCatchTest: function deprecated because of possibility of missed test cases. Consider using 'catch_discover_tests' from 'Catch.cmake'")
    ParseAndAddCatchTests_PrintDebugMessage("Started parsing ${TestTarget}")
    get_target_property(SourceFiles ${TestTarget} SOURCES)
    ParseAndAddCatchTests_PrintDebugMessage("Found the following sources: ${SourceFiles}")
    foreach(SourceFile ${SourceFiles})
        ParseAndAddCatchTests_ParseFile(${SourceFile} ${TestTarget})
    endforeach()
    ParseAndAddCatchTests_PrintDebugMessage("Finished parsing ${TestTarget}")
endfunction()

podofo/podofo test/common/cmake/ParseAndAddCatchTests.cmake :139

        string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")

        # Get string parts of test definition
        string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")

        # Strip wrapping quotation marks
        string(REGEX REPLACE "^\"(.*)\"$" "\\1" TestStrings "${TestStrings}")
        string(REPLACE "\";\"" ";" TestStrings "${TestStrings}")

        # Validate that a test name and tags have been provided
        list(LENGTH TestStrings TestStringsLength)
        if(TestStringsLength GREATER 2 OR TestStringsLength LESS 1)
            message(FATAL_ERROR "You must provide a valid test name and tags for all tests in ${SourceFile}")
        endif()

        # Assign name and tags
        list(GET TestStrings 0 Name)
        if("${TestType}" STREQUAL "SCENARIO")
            set(Name "Scenario: ${Name}")
        endif()
        if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND "${TestType}" MATCHES "(CATCH_)?TEST_CASE_METHOD" AND TestFixture )
            set(CTestName "${TestFixture}:${Name}")
        else()
            set(CTestName "${Name}")
        endif()
        if(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME)
            set(CTestName "${TestTarget}:${CTestName}")
        endif()
        # add target to labels to enable running all tests added from this target
        set(Labels ${TestTarget})
        if(TestStringsLength EQUAL 2)
            list(GET TestStrings 1 Tags)
            string(TOLOWER "${Tags}" Tags)
            # remove target from labels if the test is hidden
            if("${Tags}" MATCHES ".*\\[!?(hide|\\.)\\].*")
                list(REMOVE_ITEM Labels ${TestTarget})
            endif()
            string(REPLACE "]" ";" Tags "${Tags}")
            string(REPLACE "[" "" Tags "${Tags}")
        else()
          # unset tags variable from previous loop
          unset(Tags)
        endif()

        list(APPEND Labels ${Tags})

        set(HiddenTagFound OFF)
        foreach(label ${Labels})
            string(REGEX MATCH "^!hide|^\\." result ${label})
            if(result)
                set(HiddenTagFound ON)
                break()
            endif(result)
        endforeach(label)
        if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_LESS "3.9")
            ParseAndAddCatchTests_PrintDebugMessage("Skipping test \"${CTestName}\" as it has [!hide], [.] or [.foo] label")
        else()
            ParseAndAddCatchTests_PrintDebugMessage("Adding test \"${CTestName}\"")
            if(Labels)
                ParseAndAddCatchTests_PrintDebugMessage("Setting labels to ${Labels}")
            endif()

            # Escape commas in the test spec
            string(REPLACE "," "\\," Name ${Name})

            # Work around CMake 3.18.0 change in `add_test()`, before the escaped quotes were necessary,
            # only with CMake 3.18.0 the escaped double quotes confuse the call. This change is reverted in 3.18.1
            # And properly introduced in 3.19 with the CMP0110 policy
            if(_cmp0110_value STREQUAL "NEW" OR ${CMAKE_VERSION} VERSION_EQUAL "3.18")
                ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to NEW, no need for add_test(\"\") workaround")
            else()
                ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to OLD adding \"\" for add_test() workaround")
                set(CTestName "\"${CTestName}\"")
            endif()

            # Handle template test cases
            if("${TestTypeAndFixture}" MATCHES ".*TEMPLATE_.*")
              set(Name "${Name} - *")
            endif()

            # Add the test and set its properties
            add_test(NAME "${CTestName}" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
            # Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead
            if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
                ParseAndAddCatchTests_PrintDebugMessage("Setting DISABLED test property")
                set_tests_properties("${CTestName}" PROPERTIES DISABLED ON)
            else()
                set_tests_properties("${CTestName}" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
                                                        LABELS "${Labels}")
            endif()
            set_property(
              TARGET ${TestTarget}
              APPEND
              PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
            set_property(
              SOURCE ${SourceFile}
              APPEND
              PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
        endif()


    endforeach()
endfunction()

# entry point
function(ParseAndAddCatchTests TestTarget)
    message(DEPRECATION "ParseAndAddCatchTest: function deprecated because of possibility of missed test cases. Consider using 'catch_discover_tests' from 'Catch.cmake'")
    ParseAndAddCatchTests_PrintDebugMessage("Started parsing ${TestTarget}")
    get_target_property(SourceFiles ${TestTarget} SOURCES)
    ParseAndAddCatchTests_PrintDebugMessage("Found the following sources: ${SourceFiles}")
    foreach(SourceFile ${SourceFiles})
        ParseAndAddCatchTests_ParseFile(${SourceFile} ${TestTarget})
    endforeach()
    ParseAndAddCatchTests_PrintDebugMessage("Finished parsing ${TestTarget}")
endfunction()

OSGeo/PROJ cmake/FileEmbed.cmake :41

string(LENGTH "${content}" size)

OSGeo/PROJ cmake/ProjUtilities.cmake :28

string(LENGTH "${NAME}" varlen)

qt/qt5 coin/provisioning/common/shared/vcpkg_parse_packages.cmake :15

string(JSON element_count LENGTH "${result}")

qtwebkit/qtwebkit Source/cmake/WebKitFeatures.cmake :327

string(LENGTH ${_name} _name_length)

qtwebkit/qtwebkit Source/ThirdParty/libwebrtc/Source/third_party/boringssl/src/CMakeLists.txt :359

string(LENGTH "${CMAKE_BINARY_DIR}" root_dir_length)

qtwebkit/qtwebkit Source/ThirdParty/libwebrtc/Source/third_party/boringssl/src/third_party/android-cmake/android.toolchain.cmake :434

string( LENGTH "${ANDROID_STANDALONE_TOOLCHAIN}" __length )

ossia/score cmake/GenerateLicense.cmake :12

string(LENGTH ${${WRAP_STRING_VARIABLE}} stringLength)

ossia/score cmake/GenerateLicense.cmake :54

string(LENGTH ${hexString} hexStringLength)

sandialabs/seacas cmake/tribits/core/package_arch/TribitsETISupport.cmake :207

    string(REGEX REPLACE "^(.*)\\(.*"     "\\1" macroname${m} ${macroarg})
    string(REGEX REPLACE "^.*\\((.*)\\)$" "\\1" macrofields${m} ${macroarg})
    split("${macrofields${m}}" "," macrofields)
    tribits_eti_index_macro_fields("${etifields}" "${macrofields}" macroindex${m})
    if(${PROJECT}_VERBOSE_CONFIGURE)
      message(STATUS "Parsed macro ${macroname${m}}(${macrofields${m}}) into variable ${macrovar${m}} (index list ${macroindex${m}})")
    endif()
  endforeach()
  # process the exclusions once
  foreach(excl ${etiexcludelist})
    tribits_eti_explode("${etifields}" "${excl}" e_excl)
    if("${e_excl}" STREQUAL "TRIBITS_ETI_BAD_PARSE")
      message(FATAL_ERROR "TRIBITS_GENERATE_ETI_MACROS: exclusion did not parse: ${excl}")
    endif()
    list(APPEND processed_excludes "${e_excl}")
  endforeach()
  list(LENGTH etifields numfields)
  math(EXPR NFm1 "${numfields}-1")
  foreach(inst ${etisetvar})
    if (${PROJECT}_VERBOSE_CONFIGURE)
      message(STATUS "Processing instantiation: ${inst}") # comment
    endif()
    tribits_eti_explode("${etifields}" "${inst}" tmp)
    if("${tmp}" STREQUAL "TRIBITS_ETI_BAD_PARSE")
      message(FATAL_ERROR "TRIBITS_GENERATE_ETI_MACROS: instantiation did not parse: ${inst}")
    else()
      set(inst "${tmp}")
    endif()
    # check whether it is on the exclude list
    tribits_eti_check_exclusion("${processed_excludes}" "${inst}" excluded)
    if(NOT excluded)
      split("${inst}" "\\|" inst)
      # append tuple to list
      foreach(m RANGE 1 ${num_macros})
        set(tuple "")
        foreach(ind ${macroindex${m}})
          list(GET inst ${ind} t)
          if("${t}" STREQUAL "TYPE-MISSING")
            set(tuple "SKIP-TUPLE")
            break()
          endif()
          # mangle the types in the instantiation
          tribits_eti_mangle_symbol_augment_macro(typedeflist t manglinglist)
          list(APPEND tuple ${t})
        endforeach()
        if(NOT "${tuple}" STREQUAL "SKIP-TUPLE")
          join(tuple "|" FALSE "${tuple}")
          list(APPEND macrotuples${m} ${tuple})
        endif()
      endforeach()
    endif()
  endforeach()
  # remove duplicates from lists
  foreach(m RANGE 1 ${num_macros})
    if(DEFINED macrotuples${m})
      list(REMOVE_DUPLICATES macrotuples${m})
    endif()
  endforeach()
  # build the macro strings
  foreach(m RANGE 1 ${num_macros})
    tribits_eti_build_macro_string("${macroname${m}}" "${macrotuples${m}}" mac)
    set(${macrovar${m}} "${mac}" PARENT_SCOPE)
  endforeach()
  # build the typedef string
  set(${manglinglistvar} ${manglinglist} PARENT_SCOPE)
  set(${typedeflistvar}  ${typedeflist}  PARENT_SCOPE)
endfunction()

# generate the typedef macro
function(tribits_eti_generate_typedef_macro outputvar macroname typedeflist)
  set(mac "#define ${macroname}() ")
  foreach(td ${typedeflist})
    set(mac "${mac} \\\n\t${td};")
  endforeach()
  set(${outputvar} "${mac}" PARENT_SCOPE)
endfunction()

sandialabs/seacas cmake/tribits/core/package_arch/TribitsExternalPackageWriteConfigFile.cmake :703

string(LENGTH "${full_libname}" full_libname_len)

sandialabs/seacas cmake/tribits/core/test_support/TribitsAddTestHelpers.cmake :140

string(LENGTH ${CMND_ARG_STRING} STR_LEN)

sandialabs/seacas cmake/tribits/core/utils/TribitsFilepathHelpers.cmake :82

string(LENGTH "${absBaseDir}" absBaseDirLen)

trilinos/Trilinos cmake/tribits/core/package_arch/TribitsETISupport.cmake :207

    string(REGEX REPLACE "^(.*)\\(.*"     "\\1" macroname${m} ${macroarg})
    string(REGEX REPLACE "^.*\\((.*)\\)$" "\\1" macrofields${m} ${macroarg})
    split("${macrofields${m}}" "," macrofields)
    tribits_eti_index_macro_fields("${etifields}" "${macrofields}" macroindex${m})
    if(${PROJECT}_VERBOSE_CONFIGURE)
      message(STATUS "Parsed macro ${macroname${m}}(${macrofields${m}}) into variable ${macrovar${m}} (index list ${macroindex${m}})")
    endif()
  endforeach()
  # process the exclusions once
  foreach(excl ${etiexcludelist})
    tribits_eti_explode("${etifields}" "${excl}" e_excl)
    if("${e_excl}" STREQUAL "TRIBITS_ETI_BAD_PARSE")
      message(FATAL_ERROR "TRIBITS_GENERATE_ETI_MACROS: exclusion did not parse: ${excl}")
    endif()
    list(APPEND processed_excludes "${e_excl}")
  endforeach()
  list(LENGTH etifields numfields)
  math(EXPR NFm1 "${numfields}-1")
  foreach(inst ${etisetvar})
    if (${PROJECT}_VERBOSE_CONFIGURE)
      message(STATUS "Processing instantiation: ${inst}") # comment
    endif()
    tribits_eti_explode("${etifields}" "${inst}" tmp)
    if("${tmp}" STREQUAL "TRIBITS_ETI_BAD_PARSE")
      message(FATAL_ERROR "TRIBITS_GENERATE_ETI_MACROS: instantiation did not parse: ${inst}")
    else()
      set(inst "${tmp}")
    endif()
    # check whether it is on the exclude list
    tribits_eti_check_exclusion("${processed_excludes}" "${inst}" excluded)
    if(NOT excluded)
      split("${inst}" "\\|" inst)
      # append tuple to list
      foreach(m RANGE 1 ${num_macros})
        set(tuple "")
        foreach(ind ${macroindex${m}})
          list(GET inst ${ind} t)
          if("${t}" STREQUAL "TYPE-MISSING")
            set(tuple "SKIP-TUPLE")
            break()
          endif()
          # mangle the types in the instantiation
          tribits_eti_mangle_symbol_augment_macro(typedeflist t manglinglist)
          list(APPEND tuple ${t})
        endforeach()
        if(NOT "${tuple}" STREQUAL "SKIP-TUPLE")
          join(tuple "|" FALSE "${tuple}")
          list(APPEND macrotuples${m} ${tuple})
        endif()
      endforeach()
    endif()
  endforeach()
  # remove duplicates from lists
  foreach(m RANGE 1 ${num_macros})
    if(DEFINED macrotuples${m})
      list(REMOVE_DUPLICATES macrotuples${m})
    endif()
  endforeach()
  # build the macro strings
  foreach(m RANGE 1 ${num_macros})
    tribits_eti_build_macro_string("${macroname${m}}" "${macrotuples${m}}" mac)
    set(${macrovar${m}} "${mac}" PARENT_SCOPE)
  endforeach()
  # build the typedef string
  set(${manglinglistvar} ${manglinglist} PARENT_SCOPE)
  set(${typedeflistvar}  ${typedeflist}  PARENT_SCOPE)
endfunction()

# generate the typedef macro
function(tribits_eti_generate_typedef_macro outputvar macroname typedeflist)
  set(mac "#define ${macroname}() ")
  foreach(td ${typedeflist})
    set(mac "${mac} \\\n\t${td};")
  endforeach()
  set(${outputvar} "${mac}" PARENT_SCOPE)
endfunction()

trilinos/Trilinos cmake/tribits/core/test_support/TribitsAddExecutableTestHelpers.cmake :80

string(LENGTH ${unique_dir_path} udp_length)

trilinos/Trilinos cmake/tribits/core/test_support/TribitsAddTestHelpers.cmake :140

string(LENGTH ${CMND_ARG_STRING} STR_LEN)

trilinos/Trilinos cmake/tribits/core/utils/TimingUtils.cmake :174

string(LENGTH ${SECONDS_NS_INT_IN}  COMBINED_INT_LEN)

trilinos/Trilinos cmake/tribits/core/utils/TribitsFilepathHelpers.cmake :82

string(LENGTH "${absBaseDir}" absBaseDirLen)

trilinos/Trilinos cmake/tribits/core/utils/TribitsStripQuotesFromStr.cmake :14

string(LENGTH "${str_in}" str_len)

upx/upx CMakeLists.txt :107

string(LENGTH "${GITREV_SHORT}" l)

microsoft/vcpkg ports/qt5-webengine/portfile.cmake :2

string(LENGTH "${CURRENT_BUILDTREES_DIR}" buildtrees_path_length)

microsoft/vcpkg ports/qtwebengine/portfile.cmake :90

string(LENGTH "${CURRENT_BUILDTREES_DIR}" buildtree_length_new)

microsoft/vcpkg ports/skia/skia-functions.cmake :201

string(JSON len ERROR_VARIABLE error LENGTH "${array}")