cmake string examples

Signatures

string(FIND <string> <substring> <out-var> [...])
string(REPLACE <match-string> <replace-string> <out-var> <input>...)
string(REGEX MATCH <match-regex> <out-var> <input>...)
string(REGEX MATCHALL <match-regex> <out-var> <input>...)
string(REGEX REPLACE <match-regex> <replace-expr> <out-var> <input>...)
string(APPEND <string-var> [<input>...])
string(PREPEND <string-var> [<input>...])
string(CONCAT <out-var> [<input>...])
string(JOIN <glue> <out-var> [<input>...])
string(TOLOWER <string> <out-var>)
string(TOUPPER <string> <out-var>)
string(LENGTH <LENGTH_> <string> <out-var>)
string(SUBSTRING <string> <begin> <length> <out-var>)
string(STRIP <string> <out-var>)
string(GENEX_STRIP <string> <out-var>)
string(REPEAT <string> <count> <out-var>)
string(COMPARE <op> <string1> <string2> <out-var>)
string(<HASH> <out-var> <input>)
string(ASCII <number>... <out-var>)
string(HEX <string> <out-var>)
string(CONFIGURE <string> <out-var> [...])
string(MAKE_C_IDENTIFIER <string> <out-var>)
string(RANDOM [<option>...] <out-var>)
string(TIMESTAMP <out-var> [<format string>] [UTC])
string(UUID <out-var> ...)
string(JSON <out-var> [ERROR_VARIABLE <error-var>]
  {GET <JSON GET_> | TYPE <JSON TYPE_> | LENGTH <JSON LENGTH_> | REMOVE <JSON REMOVE_>}
<json-string> <member|index> [<member|index> ...])
string(JSON <out-var> [ERROR_VARIABLE <error-var>]
  MEMBER <JSON MEMBER_> <json-string>
[<member|index> ...] <index>)
string(JSON <out-var> [ERROR_VARIABLE <error-var>]
  SET <JSON SET_> <json-string>
<member|index> [<member|index> ...] <value>)
string(JSON <out-var> [ERROR_VARIABLE <error-var>]
  EQUAL <JSON EQUAL_> <json-string1> <json-string2>)

Examples

fzi-forschungszentrum-informatik/gpu-voxels icmaker/CMakeModules/FindGSL.cmake :86

STRING(REGEX MATCHALL "[-][L]([^ ;])+"
        GSL_LINK_DIRECTORIES_WITH_PREFIX
        "${GSL_CONFIG_LIBS}"
      )

ANTsX/ANTs CMake/GetGitRevisionDescription.cmake :118

string( REGEX MATCHALL "[a-fA-F0-9]+" rev_list "${rev_list}")

etternagame/etterna extern/filesystem/test/cmake/ParseAndAddCatchTests.cmake :130

string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")

Kitware/kwiver CMake/utils/kwiver-utils-tests-python.cmake :114

string(REGEX MATCHALL "^# TEST_PROPERTY\\(([A-Za-z_]+), (.*)\\)$"
      match "${test_line}")

openvinotoolkit/openvino src/frontends/onnx/frontend/CMakeLists.txt :14

string(REGEX MATCHALL "ONNX_OP([^;]+);" matches "${source_code}")

lightspark/lightspark conf/FindLLVM.cmake :93

STRING(REGEX MATCHALL "[^ ]*[.]o[ $]"  ${OBJECT_VAR} ${${LIB_VAR}})

ezEngine/ezEngine Code/BuildSystem/CMake/Platforms/Configure_Win.cmake :15

string(REGEX MATCHALL "\\." NUMBER_OF_DOTS "${EZ_CMAKE_WINDOWS_SDK_VERSION}")

SsageParuders/Android_Native_Surface my_android_opencv/cmake/OpenCVFindIPP.cmake :65

string(REGEX MATCHALL "[0-9]+" _MINOR ${STR2})

v6d-io/v6d cmake/DetermineImplicitIncludes.cmake :26

string(REGEX MATCHALL " (-I ?|-isystem )(\"[^\"]+\"|[^ \"]+)" incs "${line}")

OSVR/SteamVR-OSVR vendor/eigen-3.2.4/cmake/EigenTesting.cmake :136

string(REGEX MATCHALL "CALL_SUBTEST_[0-9]+|EIGEN_TEST_PART_[0-9]+|EIGEN_SUFFIXES(;[0-9]+)+"
         occurences "${test_source}")

Slicer/Slicer CMake/SlicerBlockInstallOpenSSL.cmake :12

string(REGEX MATCHALL "[0-9]+" openssl_versions "${OPENSSL_VERSION}")

AcademySoftwareFoundation/OpenImageIO src/cmake/modules/FindOpenCV.cmake :30

string (REGEX MATCHALL "[0-9]+" CV_VERSION_EPOCH ${TMP})

prophesee-ai/openeb cmake/Modules/FindPython/Support.cmake :2088

string (REGEX MATCHALL "[0-9]+" _${_PYTHON_PREFIX}_VERSIONS "${_${_PYTHON_PREFIX}_VERSION}")

mysql/mysql-connector-cpp jdbc/FindMySQL.cmake :769

string(REGEX MATCHALL "([0-9]+.[0-9]+.[0-9]+)" MYSQL_VERSION "${MYSQL_VERSION}")

FilmKilns/FilmKilns src/skia/third_party/externals/libwebp/CMakeLists.txt :130

string(REGEX MATCHALL
                   "[0-9a-z\\._]+"
                   FILES
                   ${FILES})

KiCad/kicad-source-mirror cmake/FindwxWidgets.cmake :866

string(REGEX MATCHALL "-L[^;]+"
          wxWidgets_LIBRARY_DIRS "${wxWidgets_LIBRARIES}")

rbfx/rbfx Source/ThirdParty/catch2/ParseAndAddCatchTests.cmake :132

string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")

logicalclocks/rondb unittest/gunit/xplugin/xpl/mysql_function_names.cmake :51

STRING(REGEX MATCHALL " *( |\\|) +[A-Z_0-9]+ +optional_braces" RESULT3 ${FILE_CONTENT})

chsl/PLADE code/3rd_party/opencv/cmake/OpenCVDetectAndroidSDK.cmake :98

string(REGEX MATCHALL "[^\n]+" ANDROID_SDK_TARGETS "${ANDROID_SDK_TARGETS}")

definelicht/hlslib cmake/FindIntelFPGAOpenCL.cmake :67

string(REGEX MATCHALL "-l[^ \t\n]+" INTELFPGAOCL_LINK_LIBS "${INTELFPGAOCL_LINK_FLAGS}")

mysql/mysql-shell cmake/FindMySQL.cmake :441

string(REGEX MATCHALL "([0-9]+.[0-9]+.[0-9]+)" MYSQL_VERSION "${_mysql_version}")

luoyetx/mini-caffe cmake/Cuda.cmake :134

string(REGEX MATCHALL "[0-9()]+" __cuda_arch_bin "${__cuda_arch_bin}")

INET-RC/GeoMX cmake/FirstClassLangCuda.cmake :220

string(REGEX MATCHALL "[0-9()]+" cuda_arch_bin "${cuda_arch_bin}")

facebook/mysql-5.6 unittest/gunit/xplugin/xpl/mysql_function_names.cmake :47

STRING(REGEX MATCHALL " *( |\\|) +[A-Z_0-9]+ +'\\(' +'\\)'" RESULT2 ${FILE_CONTENT})

MhLiao/RRD cmake/Cuda.cmake :104

string(REGEX MATCHALL "[0-9]+"   __cuda_arch_ptx "${__cuda_arch_ptx}")

luczeng/HoughRectangle third_party/Catch2/contrib/ParseAndAddCatchTests.cmake :130

string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")

Gecode/gecode CMakeLists.txt :76

string(REGEX MATCHALL "[^\n]*\n" CONFIG
"${CONFIG}
/* Define to 1 if you have the `getpagesize' function. */
#undef HAVE_GETPAGESIZE

/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if you have a working `mmap' system call. */
#undef HAVE_MMAP

/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H

/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H

/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H

/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H

/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H

/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

/* Define to the full name of this package. */
#undef PACKAGE_NAME

/* Define to the full name and version of this package. */
#undef PACKAGE_STRING

/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME

/* Define to the home page for this package. */
#undef PACKAGE_URL

/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT

/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
")

ovsky/sumi-emu CMakeLists.txt :267

string(REGEX MATCHALL "path *= *[^ \t\r\n]*" gitmodules ${gitmodules})

apple/foundationdb cmake/InstallLayout.cmake :29

string(REGEX MATCHALL "\\/" slashes "${IN_LINK_NAME}")

o2-engine/o2 Framework/3rdPartyLibs/jerryscript/jerry-core/CMakeLists.txt :626

string(REGEX MATCHALL "\r?\n[ ]*#[ ]*define ${PREFIX}[^\n]*"
         RAW_DEFINES "${INPUT_FILE_CONTENTS}")

RenderKit/oidn cmake/FindOpenImageIO.cmake :80

string (REGEX MATCHALL "[0-9]+" OPENIMAGEIO_VERSION_TWEAK ${TMP})

swiftlang/swift Runtimes/Supplemental/cmake/modules/gyb.cmake :19

string(REGEX MATCHALL "\\\$\{[\r\n\t ]*gyb.expand\\\([\r\n\t ]*[\'\"]([^\'\"]*)[\'\"]" gyb_expand_matches "${gyb_src}")

qt/qtmultimedia cmake/FindFFmpeg.cmake :292

string(REGEX MATCHALL "${framework_regex}" framework_dependencies ${out})

prusa3d/Prusa-Firmware-Buddy lib/Prusa-Firmware-MMU/lib/Catch2/extras/ParseAndAddCatchTests.cmake :141

string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")

parflow/parflow cmake/modules/FindHDF5.cmake :370

string( REGEX MATCHALL "${RE}" library_name_flags "${${compile_line_var}}")

Telosnex/fllama ios/llama.cpp/ggml/src/ggml-cpu/CMakeLists.txt :381

string(REGEX MATCHALL "POWER *([0-9]+)" MATCHED_STRING "${POWER10_M_UPPER}")

DynamoRIO/dynamorio api/docs/CMake_rundoxygen.cmake :205

string(REGEX MATCHALL "<tr class=\"memitem[^\n]*</tr>" types "${nosemis}")