cmake string(NAME) examples

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()

duckdb/duckdb CMakeLists.txt :895

string(TOUPPER ${NAME} EXTENSION_NAME_UPPERCASE)

duckdb/duckdb CMakeLists.txt :967

string(TOUPPER ${NAME} EXTENSION_NAME_UPPERCASE)

duckdb/duckdb CMakeLists.txt :1006

string(TOUPPER ${NAME} EXTENSION_NAME_UPPERCASE)

duckdb/duckdb CMakeLists.txt :1034

string(TOUPPER ${NAME} EXTENSION_NAME_UPPERCASE)

duckdb/duckdb CMakeLists.txt :1049

string(TOLOWER ${NAME} EXTENSION_NAME_LOWERCASE)

duckdb/duckdb CMakeLists.txt :1050

string(TOUPPER ${NAME} EXTENSION_NAME_UPPERCASE)

duckdb/duckdb CMakeLists.txt :1127

string(TOUPPER ${NAME} EXTENSION_NAME_UPPERCASE)

duckdb/duckdb CMakeLists.txt :1196

string(TOLOWER ${NAME} EXTENSION_NAME_LOWERCASE)

duckdb/duckdb CMakeLists.txt :1197

string(TOUPPER ${NAME} EXTENSION_NAME_UPPERCASE)

lammps/lammps cmake/Modules/LAMMPSUtils.cmake :173

string(REGEX REPLACE "NAME=\"?([^ ]+).*\"?" "\\1" distro "${distro}")

lexbor/lexbor config.cmake :475

STRING(REGEX REPLACE "%%NAME%%" "${module}" rpm_module_in ${rpm_module_in})

lexbor/lexbor config.cmake :682

STRING(REGEX REPLACE "%%NAME%%" "${module}" data "${data}")

lexbor/lexbor config.cmake :796

STRING(REGEX REPLACE "%%NAME%%" "${module}" data "${data}")

lexbor/lexbor config.cmake :824

STRING(REGEX REPLACE "%%NAME%%" "${module}" data "${data}")

PJK/libcbor test/CMakeLists.txt :12

string(REGEX REPLACE ".*/([^/]+).c" "\\1" NAME ${test_file})

analogdevicesinc/libiio cmake/LinuxPackaging.cmake :19

string(REGEX REPLACE "NAME=\"(.*)\"" "\\1" distro "${distro}")

sbmlteam/libsbml dev/utilities/build-python/source/create-conda-archives.cmake :56

string(REPLACE "-" "_" OTHER_NAME "${NAME}")

mfem/mfem tests/benchmarks/CMakeLists.txt :26

string(TOUPPER ${name} NAME)

mfem/mfem tests/unit/CMakeLists.txt :203

string(TOUPPER ${name} NAME)

mfem/mfem tests/unit/CMakeLists.txt :325

string(TOUPPER ${name} NAME)

mfem/mfem tests/unit/CMakeLists.txt :336

string(TOUPPER ${name} NAME)

AcademySoftwareFoundation/openvdb openvdb/openvdb/CMakeLists.txt :593

string(REGEX REPLACE "^.*/(.*).h" "\\1" NAME ${HEADER})

AcademySoftwareFoundation/openvdb openvdb/openvdb/CMakeLists.txt :596

string(TOUPPER ${NAME} UPPER_NAME)

PDAL/PDAL cmake/pluginmacros.cmake :9

string(TOLOWER ${PDAL_CREATE_PLUGIN_NAME} NAME)

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()

precice/precice cmake/discover_tests.cmake :14

string(APPEND script "${NAME}(${TEST_NAME} ${args})\n")

precice/precice cmake/discover_tests.cmake :24

string(REGEX REPLACE "[/<>]" "_" test_dir "${NAME}")

OSGeo/PROJ cmake/ProjUtilities.cmake :28

string(LENGTH "${NAME}" varlen)

LLNL/sundials cmake/macros/SundialsOption.cmake :80

string(
  CONCAT
    _warn_msg_string
    "The variable ${NAME} was set to ${${NAME}} but not all of its "
    "dependencies (${depends_on_dependencies_not_met}) evaluate to TRUE. "
    "Unsetting ${NAME}.")

microsoft/vcpkg ports/qt5-base/portfile.cmake :551

    string(REGEX REPLACE "_qt5gui_find_extra_libs\\\(EGL[^\\\n]+" "_qt5gui_find_extra_libs(EGL \"EGL\" \"\" \"\${_qt5Gui_install_prefix}/include\")\n" _contents "${_contents}")
    file(WRITE "${_file}" "${_contents}")
endif()

vcpkg_fixup_pkgconfig()

if(VCPKG_TARGET_IS_OSX)
    file(GLOB _debug_files "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/*_debug.pc")
    foreach(_file ${_debug_files})
        string(REGEX REPLACE "_debug\\.pc$" ".pc" _new_filename "${_file}")
        string(REGEX MATCH "(Qt5[a-zA-Z]+)_debug\\.pc$" _not_used "${_file}")
        set(_name ${CMAKE_MATCH_1})
        file(STRINGS "${_file}" _version REGEX "^(Version):.+$")
        file(WRITE "${_new_filename}" "Name: ${_name}\nDescription: Forwarding to the _debug version by vcpkg\n${_version}\nRequires: ${_name}_debug\n")
    endforeach()
endif()
# #Code to get generated CMake files from CI
# file(RENAME "${CURRENT_PACKAGES_DIR}/share/cmake/Qt5Core/Qt5CoreConfig.cmake" "${CURRENT_BUILDTREES_DIR}/Qt5CoreConfig.cmake.log")
# file(GLOB_RECURSE CMAKE_GUI_FILES "${CURRENT_PACKAGES_DIR}/share/cmake/Qt5Gui/*.cmake" )
# foreach(cmake_file ${CMAKE_GUI_FILES})
    # get_filename_component(cmake_filename "${cmake_file}" NAME)
    # file(COPY "${cmake_file}" DESTINATION "${CURRENT_BUILDTREES_DIR}")
    # file(RENAME "${CURRENT_BUILDTREES_DIR}/${cmake_filename}" "${CURRENT_BUILDTREES_DIR}/${cmake_filename}.log")
# endforeach()
# #Copy config.log from buildtree/triplet to buildtree to get the log in CI in case of failure
# if(EXISTS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/config.log")
    # file(RENAME "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/config.log" "${CURRENT_BUILDTREES_DIR}/config-rel.log")
# endif()
# if(EXISTS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/config.log")
    # file(RENAME "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/config.log" "${CURRENT_BUILDTREES_DIR}/config-dbg.log")
# endif()
# message(FATAL_ERROR "Need Info from CI!")