[CMake] CMake uses semi-colon as path separator on Linux

Nils Gladitz nilsgladitz at gmail.com
Fri Apr 14 02:24:13 EDT 2017


On 14.04.2017 06:05, Pawel Veselov wrote:
> Hello.
>
> I really can't understand what's going on. Trying to compile my project
> for android, setting all kinds of things to get it done. I've tried 3.8.0,
> 3.7.2 and 3.6.2, with the same result. The below extracts are from running
> 3.6.2
>
> Running with --debug and --trace, I see:
>
> /usr/share/cmake/Modules/FindPkgConfig.cmake(91):
> _pkgconfig_set(JSONC_CFLAGS ${_pkgconfig_invoke_result} )
> /usr/share/cmake/Modules/FindPkgConfig.cmake(64):  set(JSONC_CFLAGS
> -I/tmp/arm-23/include/json-c;-I/tmp/arm-23/include CACHE INTERNAL  )
>
> I ran strace, and I can see pkg-config returning paths normally, just spaces.
>
> Running make on the generated makefiles:
>
> /tmp/arm-23/bin/arm-linux-androideabi-gcc    -g -ggdb -O0 --std=c99
> -isystem/home/vps/ws/EF/DMClient/android_src/http-parser
> -isystem/usr/include
> -isystem/home/vps/ws/EF/DMClient/android_src/wslay/lib/includes
> -I/tmp/arm-23/include/json-c;-I/tmp/arm-23/include -isystem
> /tmp/arm-23/include -isystem /tmp/arm-23/include/libxml2   -o
> CMakeFiles/dmclient.dir/config.c.o   -c
> /home/vps/ws/EF/DMClient/config.c
>
> The semicolons are in the ./CMakeFiles/node_editor.dir/flags.make
>
> The CMakeLists.txt has this line:
> pkg_check_modules(JSONC REQUIRED json-c openssl)
>
> At this point, I'm running CMake without any fancy command, the compiler
> location and such are derived from environment variables.
>
> I tried using the NDK flags (with 3.8, and using toolchain), but then
> realized this reproduces even without them (and on 3.6)
>
> Any idea what drags in those semicolons?

CMake uses semicolons to separate list elements:
https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#lists

Some CMake commands / variables / properties expect ";"-separated lists 
(e.g. target_compile_options(), COMPILE_OPTIONS) and some expect strings 
with whitespace separated arguments (e.g. CMAKE_C_FLAGS, COMPILE_FLAGS).

Presumably you are feeding the list to something that expects the latter.

Nils


More information about the CMake mailing list