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
-- 

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

Reply via email to