I'm trying to write a CMakeLists.txt
file for a project with some Makefile
-based dependencies. To build the dependencies I use ExternalProject CMake plugin. In simple cases all is OK. But now I want to redefine CFLAGS
variable for Makefile
-based subproject and cannot do it.
I want to set the following:
CFLAGS='-fPIC -mfloat-abi=softfp -mfpu=neon'
If I use this string literally in BUILD_COMMAND
tag, the generated Makefile
contains the following:
"CFLAGS='-fPIC" -mfloat-abi=softfp "-mfpu=neon'"
So I get this error during compilation:
/bin/sh: 1: CFLAGS='-fPIC: not found
If I use "CFLAGS='-fPIC -mfloat-abi=softfp -mfpu=neon'"
, I get
"CFLAGS='-fPIC -mfloat-abi=softfp -mfpu=neon'"
in generated Makefile
and get this:
/bin/sh: 1: CFLAGS='-fPIC -mfloat-abi=softfp -mfpu=neon': not found
Is there a right way to quote string with whitespaces in CMake?