Closed andrmuel closed 5 years ago
What's the use case for having a space in the option?
In my case, there is CMake option that accepts multiple file names, separated by a space.
On 20/10/2018 19.07, Atila Neves wrote:
What's the use case for having a space in the option?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/atilaneves/cmake-ide/issues/181#issuecomment-431599913, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcLoss297JPzTafF4anb6thJtWKmuoLks5um1hrgaJpZM4XWNHY.
I looked at your original example again and -DCONF_FILES=foo.conf bar.conf
won't work at all with clang. It'll be just one #define
(foo.conf). I don't know about your CMake option but unless there are quotes around the space-delimited list, that won't work either.
Are you using an old version of cmake-ide
? It doesn't use split-string
but split-string-and-unquote
. I explained the history why in my comment on issue #177
I was using cmake-ide-20180713; I see the split-string-and-unquote only in cide--split-command (which as I understand is not relevant for cmake-ide-cmake-opts).
I actually started out with something like -DCONF_FILES=\"foo.conf bar.conf\", but the only way I could actually get it to work is as described above.
The actual example I'm working with is the Zephyr OS (https://github.com/zephyrproject-rtos/zephyr), and my actual config is
(setq-local cmake-ide-cmake-opts '("-GNinja" "-DBOARD=nrf52840_pca10056" "-DCONF_FILE=prj.conf overlay-bt.conf"))
Looking at Zephyr itself, I see in cmake/kconfig.cmake:
string(REPLACE " " ";" CONF_FILE_AS_LIST "${CONF_FILE}")
Maybe this is the reason why I don't just get a #define foo.conf.
On 22/10/2018 14.11, Atila Neves wrote:
I looked at your original example again and |-DCONF_FILES=foo.conf bar.conf| won't work at all with clang. It'll be just one |#define| (foo.conf). I don't know about your CMake option but unless there are quotes around the space-delimited list, that won't work either.
Are you using an old version of |cmake-ide|? It doesn't use |split-string| but |split-string-and-unquote|. I explained the history why in my comment on issue #177 https://github.com/atilaneves/cmake-ide/issues/177
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/atilaneves/cmake-ide/issues/181#issuecomment-431831168, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcLoqsbHCxDGaDCGoPCxtCjYEwBO8Oeks5uncPygaJpZM4XWNHY.
Sorry, I misread your issue. I now understand what you mean.
The problem is that cmake-ide-cmake-opts
should never have been a string but instead a list of strings. I didn't add that one and didn't think it through when I merged it.
Due to the 'split-string' in
cide--run-cmake-impl
, it is not possible to have a space in a parameter incmake-ide-cmake-opts
(e.g. "-DCONF_FILES=foo.conf bar.conf").My workaround for the moment is to allow passing the parameters as lists:
Maybe this could be added to cmake-ide?