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

o3de/o3de cmake/SettingsRegistry.cmake :292

string(JOIN "." specialization_name ${prefix} ${escaped_target})

chdb-io/chdb contrib/google-cloud-cpp-cmake/GoogleApis.cmake :410

string(
    JOIN
    " "
    GOOGLE_CLOUD_CPP_PC_REQUIRES
    "google_cloud_cpp_bigtable_protos"
    "google_cloud_cpp_cloud_bigquery_protos"
    "google_cloud_cpp_iam_protos"
    "google_cloud_cpp_pubsub_protos"
    "google_cloud_cpp_storage_protos"
    "google_cloud_cpp_logging_protos"
    "google_cloud_cpp_iam_v1_iam_policy_protos"
    "google_cloud_cpp_iam_v1_options_protos"
    "google_cloud_cpp_iam_v1_policy_protos"
    "google_cloud_cpp_longrunning_operations_protos"
    "google_cloud_cpp_api_auth_protos"
    "google_cloud_cpp_api_annotations_protos"
    "google_cloud_cpp_api_client_protos"
    "google_cloud_cpp_api_field_behavior_protos"
    "google_cloud_cpp_api_http_protos"
    "google_cloud_cpp_rpc_status_protos"
    "google_cloud_cpp_rpc_error_details_protos"
    "google_cloud_cpp_type_expr_protos"
    "grpc++"
    "grpc"
    "openssl"
    "protobuf"
    "zlib"
    "libcares")

scylladb/seastar cooking_recipe.cmake :147

string (JOIN " <cxxflags>" boost_cxxflags
    "<cxxflags>${CMAKE_CXX_FLAGS}")

qt/qtbase cmake/QtHeadersClean.cmake :220

string(JOIN "\n" headers_check_parameters_content
        "set(HEADER_CHECK_EXCEPTIONS"
        "    \"${header_check_exceptions}\")"
        "set(HEADER_CHECK_COMPILER_COMMAND_LINE"
        "    \[\[$<JOIN:${compiler_command_line},\]\]\n    \[\[>\]\]\n"
        "    ${compiler_command_line_variables}"
        ")"
    )

digego/extempore CMakeRC.cmake :414

string(CONFIGURE [=[
        #include <cmrc/cmrc.hpp>
        #include <map>
        #include <utility>

        namespace cmrc {
        namespace @ARG_NAMESPACE@ {

        namespace res_chars {
        // These are the files which are available in this resource library
        $<JOIN:$<TARGET_PROPERTY:@libname@,CMRC_EXTERN_DECLS>,
        >
        }

        namespace {

        const cmrc::detail::index_type&
        get_root_index() {
            static cmrc::detail::directory root_directory_;
            static cmrc::detail::file_or_directory root_directory_fod{root_directory_};
            static cmrc::detail::index_type root_index;
            root_index.emplace("", &root_directory_fod);
            struct dir_inl {
                class cmrc::detail::directory& directory;
            };
            dir_inl root_directory_dir{root_directory_};
            (void)root_directory_dir;
            $<JOIN:$<TARGET_PROPERTY:@libname@,CMRC_MAKE_DIRS>,
            >
            $<JOIN:$<TARGET_PROPERTY:@libname@,CMRC_MAKE_FILES>,
            >
            return root_index;
        }

        }

        cmrc::embedded_filesystem get_filesystem() {
            static auto& index = get_root_index();
            return cmrc::embedded_filesystem{index};
        }

        } // @ARG_NAMESPACE@
        } // cmrc
    ]=] cpp_content @ONLY)

mxcop/src-dgi extern/entt/CMakeLists.txt :10

string(JOIN "." ENTT_VERSION ${ENTT_VERSION})

nrfconnect/sdk-zephyr boards/qemu/x86/board.cmake :40

string(JOIN "," QEMU_CPU_FLAGS "${QEMU_CPU_FLAGS}" "sse")

NVIDIA/cuda-samples Samples/3_CUDA_Features/memMapIPCDrv/CMakeLists.txt :56

string(JOIN " " INCLUDES "${INCLUDES_LIST}")