Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake error with string sub-command STRIP "requires two arguments"

Tags:

cmake

I am trying to compile a library with CMake. This library uses CMake with the pods build system. During configuring I get the following error:

CMake Error at cmake/pods.cmake:257 (string): 
string sub-command STRIP requires two arguments.

In the specific file pods.cmake the command looks like this:

execute_process(COMMAND 
  ${PKG_CONFIG_EXECUTABLE} --cflags-only-I ${ARGN}
  OUTPUT_VARIABLE _pods_pkg_include_flags)
string(STRIP ${_pods_pkg_include_flags} _pods_pkg_include_flags)

which looks fine to me. Any ideas why this error occurs? I don't understand why cmake complains that it needs two arguments for the STRIP command when it clearly has two.

Note: I use cmake 2.8.12.2, but according to the documentation this should be valid.

like image 720
Chris85 Avatar asked Oct 27 '14 10:10

Chris85


1 Answers

While your CMake file does syntactically contain two arguments, ${_pods_pkg_include_flags} can be empty. If so, it is not an argument semantically and never reaches string(), which then sees just one. If it's possible for a string to be empty (and you want to treat it as an empty string in such case instead of skipping it), quote it:

string(STRIP "${_pods_pkg_include_flags}" _pods_pkg_include_flags)
like image 72
Angew is no longer proud of SO Avatar answered Oct 25 '22 09:10

Angew is no longer proud of SO