changeset 326:ad28f6b60e6b

Fix nsstest build for windows
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 07 Apr 2014 14:50:08 +0000
parents c89bfb0e638e
children 3261b2a9cab7
files ui/tests/CMakeLists.txt ui/tests/nsstest.cpp
diffstat 2 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ui/tests/CMakeLists.txt	Mon Apr 07 13:40:54 2014 +0000
+++ b/ui/tests/CMakeLists.txt	Mon Apr 07 14:50:08 2014 +0000
@@ -18,7 +18,8 @@
 macro(add_m13_test _source _additional_sources)
   set(_test ${_source})
   get_filename_component(_name ${_source} NAME_WE)
-  set(_test_sources_with_resources ${_test} "${_additional_sources};${CMAKE_CURRENT_SOURCE_DIR}/common.cpp")
+  set(_test_sources_with_resources ${_test}
+     "${_additional_sources};${CMAKE_CURRENT_SOURCE_DIR}/common.cpp")
   qt5_add_resources(_test_sources_with_resources
      ${CMAKE_CURRENT_SOURCE_DIR}/data/testdata.qrc)
   add_executable(${_name} ${_test_sources_with_resources})
@@ -51,10 +52,14 @@
 endif (WIN32)
 
 if (NSS_FOUND)
-    include_directories(${NSS_INCLUDE_DIRS})
-    add_m13_test(nsstest.cpp "${CERTIFICATELIST_SOURCES};${CMAKE_SOURCE_DIR}/cinst/nssstore_linux.c")
-    target_link_libraries(nsstest ${NSS_LIBRARIES})
-    add_dependencies(nsstest mozilla)
+   include_directories(${NSS_INCLUDE_DIRS})
+   add_m13_test(nsstest.cpp "${CERTIFICATELIST_SOURCES};${CMAKE_SOURCE_DIR}/cinst/nssstore_linux.c;${CMAKE_SOURCE_DIR}/cinst/nssstore_win.c")
+   target_link_libraries(nsstest ${NSS_LIBRARIES})
+   if (WIN32)
+      target_link_libraries(nsstest -luserenv)
+   endif()
+
+   add_dependencies(nsstest mozilla)
 endif()
 
 #add_m13_test(${CMAKE_SOURCE_DIR}/ui/main.cpp "${M13UI_SOURCES}")
--- a/ui/tests/nsstest.cpp	Mon Apr 07 13:40:54 2014 +0000
+++ b/ui/tests/nsstest.cpp	Mon Apr 07 14:50:08 2014 +0000
@@ -72,7 +72,12 @@
     fakeFirefoxDir = QDir(fakeHome.path() + "/.mozilla/firefox");
     fakeThunderbirdDir = QDir(fakeHome.path() + "/.thunderbird");
 #else
-    QVERIFY(!setenv ("APPDATA", fakeHome.path().toLocal8Bit().constData(), 1));
+    {
+        char buf[fakeHome.path().toLocal8Bit().size() + 9];
+        snprintf(buf, fakeHome.path().toLocal8Bit().size() + 9,
+                "APPDATA=%s",fakeHome.path().toLocal8Bit().constData());
+        QVERIFY(_putenv (buf) != -1);
+    }
     fakeFirefoxDir = QDir(fakeHome.path() + "/Mozilla/firefox");
     fakeThunderbirdDir = QDir(fakeHome.path() + "/Thunderbird");
 #endif

http://wald.intevation.org/projects/trustbridge/