The following example demonstrates a way for you to achieve what you need:
cmake_minimum_required(VERSION 2.8) project(t1) include(CTest) add_test(NAME test01 COMMAND ${CMAKE_COMMAND} -E environment) set_property(TEST test01 APPEND PROPERTY ENVIRONMENT Z1ENV=1;2;3 Z2ENV=a;b;c) add_test(NAME test02 COMMAND ${CMAKE_COMMAND} -E environment) set_property(TEST test02 APPEND PROPERTY ENVIRONMENT Z1ENV=1\;2\;3 Z2ENV=a\;b\;c) add_test(NAME test03 COMMAND ${CMAKE_COMMAND} -E environment) set_property(TEST test03 APPEND PROPERTY ENVIRONMENT "Z1ENV=1\;2\;3" "Z2ENV=a\;b\;c") Only test03 actually produces the sort of results you want with semi-colons embedded in the env variable value. So: escape the semi-colons in the PATH value and enclose "PATH=${path_value}" in double quotes That should give you what you need. To escape the semi-colons, use: string(REPLACE ";" "\\;" path_value "${path_value}") Let us know if this works for you and what your final code looks like so others can reference it too. HTH, David On Wed, Oct 10, 2012 at 8:57 AM, Jakub Zakrzewski <jzakrzew...@e2e.ch> wrote: > Hi, thanks for response. > > Unfotunatly: > > set(THIRD_PARTY_LIBS "${THIRD_PARTY_LIBS}\;${JAVA_JVM_LIBRARY_PATH}"); > > SET_TESTS_PROPERTIES(ut PROPERTIES ENVIRONMENT > "BRIDGESERVER_BIN=D:/Projects/e2e_bridge/server/head/src/AddOns/PersistentState;PATH=\"D:/Projects/e2e_bridge/server/head/bin/win64-debug;C:/Program > > Files/Java/jdk1.6.0_30/lib/../jre/bin/server\";INSTANCES_HOME=D:/Projects/e2e_bridge/server/head/build/win64-debug;INSTANCE_HOME=D:/Projects/e2e_bridge/server/head/build/win64-debug") > > This looks correct at first glance, but doesn't work. I mean the PATH is > definatly not set correctly as jvm.dll is not found. When I set it manually > before running the "ut" executable, it's OK. > > -- > Gruesse, > Jakub > > > > > From: Petr Kmoch [mailto:petr.km...@gmail.com] > Sent: Mittwoch, 10. Oktober 2012 14:40 > To: Jakub Zakrzewski > Cc: cmake@cmake.org > Subject: Re: [CMake] Setting test environment on windows > > Hi Jakub. > > I would try adding quotes around the dereference of THIRD_PARTY_LIBS. That is: > set_properties(... PATH="${THIRD_PARTY_LIBS}" ...) > > Petr > On Wed, Oct 10, 2012 at 2:13 PM, Jakub Zakrzewski <jzakrzew...@e2e.ch> wrote: > Hi All. > > Could someone explain to me, how properly set environment for CTest from > CMakeLists.txt? > > Ihave something like: > > set(THIRD_PARTY_LIBS "${THIRD_PARTY_LIBS};${JAVA_JVM_LIBRARY_PATH}"); > set_properties(TEST myTest PROPERTY ENVIRONMENT > BRIDGESERVER_BIN=${PROJECT_SOURCE_DIR}/src/AddOns/PersistentState > PATH=${THIRD_PARTY_LIBS} > INSTANCES_HOME=${CMAKE_BINARY_DIR} > INSTANCE_HOME=${CMAKE_BINARY_DIR} > ) > > This gets expanded to: > SET_TESTS_PROPERTIES(ut PROPERTIES ENVIRONMENT > "BRIDGESERVER_BIN=D:/Projects/e2e_bridge/server/head/src/AddOns/PersistentState;PATH=D:/Projects/e2e_bridge/server/head/bin/win64-debug;C:/Program > > Files/Java/jdk1.6.0_30/lib/../jre/bin/server;INSTANCES_HOME=D:/Projects/e2e_bridge/server/head/build/win64-debug;INSTANCE_HOME=D:/Projects/e2e_bridge/server/head/build/win64-debug") > > Which is wrong (note the semicolon). Below are my trials and their results: > > > #1st > set(THIRD_PARTY_LIBS "${THIRD_PARTY_LIBS}\;${JAVA_JVM_LIBRARY_PATH}"); > > SET_TESTS_PROPERTIES(ut PROPERTIES ENVIRONMENT > "BRIDGESERVER_BIN=D:/Projects/e2e_bridge/server/head/src/AddOns/PersistentState;PATH=D:/Projects/e2e_bridge/server/head/bin/win64-debug;C:/Program > > Files/Java/jdk1.6.0_30/lib/../jre/bin/server;INSTANCES_HOME=D:/Projects/e2e_bridge/server/head/build/win64-debug;INSTANCE_HOME=D:/Projects/e2e_bridge/server/head/build/win64-debug") > > #2nd > set(THIRD_PARTY_LIBS "${THIRD_PARTY_LIBS}\\;${JAVA_JVM_LIBRARY_PATH}"); > > SET_TESTS_PROPERTIES(ut PROPERTIES ENVIRONMENT > "BRIDGESERVER_BIN=D:/Projects/e2e_bridge/server/head/src/AddOns/PersistentState;PATH=D:/Projects/e2e_bridge/server/head/bin/win64-debug;C:/Program > > Files/Java/jdk1.6.0_30/lib/../jre/bin/server;INSTANCES_HOME=D:/Projects/e2e_bridge/server/head/build/win64-debug;INSTANCE_HOME=D:/Projects/e2e_bridge/server/head/build/win64-debug") > > #3rd > set(THIRD_PARTY_LIBS "${THIRD_PARTY_LIBS}\\\;${JAVA_JVM_LIBRARY_PATH}"); > > SET_TESTS_PROPERTIES(ut PROPERTIES ENVIRONMENT > "BRIDGESERVER_BIN=D:/Projects/e2e_bridge/server/head/src/AddOns/PersistentState;PATH=D:/Projects/e2e_bridge/server/head/bin/win64-debug\\\\;C:/Program > > Files/Java/jdk1.6.0_30/lib/../jre/bin/server;INSTANCES_HOME=D:/Projects/e2e_bridge/server/head/build/win64-debug;INSTANCE_HOME=D:/Projects/e2e_bridge/server/head/build/win64-debug") > > #4th > set(THIRD_PARTY_LIBS "${THIRD_PARTY_LIBS}\\\\;${JAVA_JVM_LIBRARY_PATH}"); > > SET_TESTS_PROPERTIES(ut PROPERTIES ENVIRONMENT > "BRIDGESERVER_BIN=D:/Projects/e2e_bridge/server/head/src/AddOns/PersistentState;PATH=D:/Projects/e2e_bridge/server/head/bin/win64-debug\\\\;C:/Program > > Files/Java/jdk1.6.0_30/lib/../jre/bin/server;INSTANCES_HOME=D:/Projects/e2e_bridge/server/head/build/win64-debug;INSTANCE_HOME=D:/Projects/e2e_bridge/server/head/build/win64-debug") > > #5th > set(THIRD_PARTY_LIBS "${THIRD_PARTY_LIBS}\\\\\;${JAVA_JVM_LIBRARY_PATH}"); > > SET_TESTS_PROPERTIES(ut PROPERTIES ENVIRONMENT > "BRIDGESERVER_BIN=D:/Projects/e2e_bridge/server/head/src/AddOns/PersistentState;PATH=D:/Projects/e2e_bridge/server/head/bin/win64-debug\\\\;C:/Program > > Files/Java/jdk1.6.0_30/lib/../jre/bin/server;INSTANCES_HOME=D:/Projects/e2e_bridge/server/head/build/win64-debug;INSTANCE_HOME=D:/Projects/e2e_bridge/server/head/build/win64-debug") > > I don't understand, the logic of escaping here. > -- > Gruesse, > Jakub > > > -- > > 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 > > -- > > 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 -- 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