On 06/22/2011 09:14 PM, Hauke Heibel wrote: > Hi, > > My CMake version is 2.8.3 and I am trying to run a CMake script as a > custom target via > > add_custom_target(RunFooTarget ALL > COMMAND ${CMAKE_COMMAND} > -DMY_VARIABLE=${ARGUMENTS} > -P Foo.cmake > VERBATIM > ) > > where ${ARGUMENTS} is a standard CMake list (semi-colon separated). > Unfortunately, this list is always converted into a white-space > separated list for the target. > > I tried to put ${ARGUMENTS} in quotes as well as escaped quotes but > the list is always converted. > > My workaround is a foreach loop in which I am concatenating the > individual list elements via "*" and within Foo.cmake, I am reverting > this change through > > string(REGEX REPLACE "\*" ";" MY_VARIABLE ${MY_VARIABLE}) > > in order to get back to my actual list - but that seems hackish. > > Any ideas how to prevent the conversion I mentioned above? > > Regards, > Hauke
You might use -DMY_VARIABLE="${ARGUMENTS}" without VERBATIM, and SEPARATE_ARGUMENTS(MY_VARIABLE) in Foo.cmake. This doesn't prevent the list's conversion, but seems a bit smarter than a FOREACH loop. 'hope that helps. Regards, Michael _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake