Weiqiang Guo
Weiqiang Guo

Reputation: 23

Cmake Error:STRING sub-command REPLACE requires at least four arguments

Cmake version:3.20.0 platform: macOS 11.1

When I tried to compiler a library with Cmake, I got the following error:

    CMake Error at CMakeLists.txt:45 (STRING):
  STRING sub-command REPLACE requires at least four arguments.

The corresponding code is shown below:

    STRING(REPLACE "'" "\"" HYMLS_REVISION ${rev})

In there, I want to replace ' with " . I don't find any error. It should be valid. Could anyone help with this?

Upvotes: 2

Views: 6086

Answers (1)

feseal
feseal

Reputation: 21

Use quotes around ${rev} variable

STRING(REPLACE "'" "\"" HYMLS_REVISION "${rev}")

Upvotes: 2

Related Questions