I did find a solution that works - if I remove the EXTRA_FLAGS
parameter and instead use ${ARGN} and pass the extra defines as normal
then it doesn't get extra quoted.On Sat, Nov 19, 2011 at 6:21 PM, J Decker <[email protected]> wrote: > I have a chain of cmakelists that have to be run in sequence with some > other commands inbetween... I have been working on a cmakelists.txt > which builds the project... > > This is a simple project that demonstrates the issue... > ----------------- CMakeLists.txt ---------------------- cmake_minimum_required(VERSION 2.8) project( test_build_all ) macro( BuildProject ARG1 ) message( "[${ARGN}]" ) add_custom_target( Build${ARG1} COMMAND echo ${ARGN} ) endmacro( BuildProject ) set( EXTRA_FLAGS "-DOPTION1=ON -DOPTION2=OFF" ) BuildProject( Test1 ${EXTRA_FLAGS} ) set( EXTRA_FLAGS -DOPTION1=ON -DOPTION2=OFF ) BuildProject( Test2 ${EXTRA_FLAGS} ) set( EXTRA_FLAGS -DOPTION1=ON\ -DOPTION2=OFF ) BuildProject( Test3 ${EXTRA_FLAGS} ) ----------------- END ---------------------- > > > The above script makes scripts which build 3 targets that prints a > message during configuration and runs a simple echo command. > > cmake output (see no quotes) > [-DOPTION1=ON -DOPTION2=OFF] > [-DOPTION1=ON] > [-DOPTION1=ON -DOPTION2=OFF] > > generated output > BuildTest1 : echo "-DOPTION1=ON -DOPTION2=OFF" > BuildTest2 : echo -DOPTION1=ON > BuildTest3 : echo "-DOPTION1=ON -DOPTION2=OFF" > > > The problem is; there are no Quotes in the command 'echo > ${EXTRA_FLAGS}' but yet the command gets the quotes. > There are really NO quotes anywhere in the case of BuildTest3, but the > command has quotes when issuing the command line. > > -------------- > > What the intent is is to be able to define one or more addional -D > flags that get passed to a cmake command instead of an echo command, > but with the extra quotes, the second (and further) defined values are > unreachable. > > How can I set(EXTRA_FLAGS) that I can pass it as a single thing to a > macro parameter to be used in add target. > > I did test that this is not a specific issue with visual studio 2010, > and if it is, it's also an issue with mingw makefiles also [aka I > tested a couple of generators and both did the same thing]. > -- 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
