Hello, in my build process I need to call a compiler like tool with the same include directories as a certain target.I tried the following: cmake_minimum_required(VERSION 3.2) project(cmake-genex C) add_library(dummy dummy.c foo.c) target_include_directories(dummy PUBLIC foo bar) set(prop "$<TARGET_PROPERTY:dummy,INCLUDE_DIRECTORIES>") set(lst "$<$<BOOL:${prop}>:-I$<JOIN:${prop}, -I>>") add_custom_command(OUTPUT foo.c COMMAND echo ${lst} ) Unfortunately this results in an escaped space before the -I : echo -I/Users/gjasny/src/cmake-genex/foo\ -I/Users/gjasny/src/cmake-genex/bar Is there a way to convince CMake not to escape the space? It looks like whatever I do, the generator expression is handled like a single string. Thanks, Gregor
A bug related to this problem is on the backlog [1]. A workaround is attached to the bug report [2], and an example usage of the workaround is in the comments.
[1] http://public.kitware.com/Bug/view.php?id=14353 [2] http://public.kitware.com/Bug/file_download.php?file_id=5436&type=bug -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
