[CMake] Setting test environment on windows

Jakub Zakrzewski jzakrzewski at e2e.ch
Wed Oct 10 08:57:55 EDT 2012


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.kmoch at gmail.com] 
Sent: Mittwoch, 10. Oktober 2012 14:40
To: Jakub Zakrzewski
Cc: cmake at 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 <jzakrzewski at 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



More information about the CMake mailing list