CMake error with STRIP string subcommand "requires two arguments"

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

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

      

In a specific pods.cmake file, 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 good 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 am using cmake 2.8.12.2, but according to the documentation it should be valid.

+3


source to share


1 answer


As long as your CMake file syntactically contains two arguments, it ${_pods_pkg_include_flags}

can be empty. If so, it is not an argument semantically and never reaches string()

, which then only one sees. If it is possible for the line to be empty (and you want to treat it as an empty line in that case, rather than skip it), quote it:



string(STRIP "${_pods_pkg_include_flags}" _pods_pkg_include_flags)

      

+7


source







All Articles