[Pcre-svn] [1053] code/trunk: Improved CMake support under W…

Startseite
Nachricht löschen
Autor: Subversion repository
Datum:  
To: pcre-svn
Betreff: [Pcre-svn] [1053] code/trunk: Improved CMake support under Windows.
Revision: 1053
          http://vcs.pcre.org/viewvc?view=rev&revision=1053
Author:   zherczeg
Date:     2012-10-09 16:43:08 +0100 (Tue, 09 Oct 2012)


Log Message:
-----------
Improved CMake support under Windows.

Modified Paths:
--------------
    code/trunk/CMakeLists.txt
    code/trunk/ChangeLog
    code/trunk/RunTest.bat


Modified: code/trunk/CMakeLists.txt
===================================================================
--- code/trunk/CMakeLists.txt    2012-10-03 11:36:18 UTC (rev 1052)
+++ code/trunk/CMakeLists.txt    2012-10-09 15:43:08 UTC (rev 1053)
@@ -682,8 +682,8 @@
   FILE(WRITE ${PROJECT_BINARY_DIR}/CTestCustom.ctest
   "# This is a generated file.
 MESSAGE(\"When testing is complete, review test output in the
-${PROJECT_BINARY_DIR}/Testing/Temporary folder.\")
-MESSAGE(\"\")
+\\\"${PROJECT_BINARY_DIR}/Testing/Temporary\\\" folder.\")
+MESSAGE(\" \")
 ")


FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_test.sh
@@ -719,37 +719,24 @@

   IF(WIN32)
     # Provide environment for executing the bat file version of RunTest
-    string(REPLACE "/" "\\" winsrc "${PROJECT_SOURCE_DIR}")
+    FILE(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} winsrc)
+    FILE(TO_NATIVE_PATH ${PROJECT_BINARY_DIR} winbin)
+    FILE(TO_NATIVE_PATH ${PCRETEST_EXE} winexe)


-    FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_test.txt
+    FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_test.bat
     "\@REM This is a generated file.
-\@Echo off
+\@echo off
 setlocal
-SET\ srcdir=\${srcdir}
-SET\ pcretest=\${pcretest}
-call \"\${srcdir}\\RunTest.Bat\"
+SET srcdir=\"${winsrc}\"
+SET pcretest=\"${winexe}\"
+if not [%CMAKE_CONFIG_TYPE%]==[] SET pcretest=\"${winbin}\\%CMAKE_CONFIG_TYPE%\\pcretest.exe\"
+call %srcdir%\\RunTest.Bat
 if errorlevel 1 exit /b 1
 echo RunTest.bat tests successfully completed
 ")


- FILE(WRITE ${PROJECT_BINARY_DIR}/BatDriver.cmake
- "# This is a generated file.
-# this script is run with arguments via the cmake command in add_test(NAME pcre_test_bat)
-# BatDriver feeds the actual location of pcretest.exe
-FILE(TO_NATIVE_PATH \${pcretestx} pcretest)
-FILE(TO_NATIVE_PATH \${srcdirx} srcdir)
-configure_file(\"\${bindirx}/pcre_test.txt\" \"\${bindirx}/pcre_test.bat\")
-# MESSAGE(\"cmake\ variable\ pcretest\ is\ \${pcretest}\")
-# STRING(REPLACE \" \" \"\\ \" bindir \${bindirx})
-MESSAGE(\"COMMAND pcre_test.bat \")
-EXECUTE_PROCESS(COMMAND pcre_test.bat
-WORKING_DIRECTORY .
-OUTPUT_VARIABLE batoutput)
-MESSAGE(\"OUTPUT: \${batoutput}\")
-")
-
ADD_TEST(NAME pcre_test_bat
- COMMAND ${CMAKE_COMMAND} -D bindirx=${PROJECT_BINARY_DIR} -D srcdirx=${PROJECT_SOURCE_DIR} -D pcretestx=$<TARGET_FILE:pcretest> -P "${PROJECT_BINARY_DIR}/BatDriver.cmake")
+ COMMAND pcre_test.bat)
SET_TESTS_PROPERTIES(pcre_test_bat PROPERTIES
PASS_REGULAR_EXPRESSION "RunTest\\.bat tests successfully completed")


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2012-10-03 11:36:18 UTC (rev 1052)
+++ code/trunk/ChangeLog    2012-10-09 15:43:08 UTC (rev 1053)
@@ -118,6 +118,9 @@


22. Unicode character properties were updated from Unicode 6.2.0

+23. Improved CMake support under Windows. Patch by Daniel Richard G.
+
+
Version 8.31 06-July-2012
-------------------------


Modified: code/trunk/RunTest.bat
===================================================================
--- code/trunk/RunTest.bat    2012-10-03 11:36:18 UTC (rev 1052)
+++ code/trunk/RunTest.bat    2012-10-09 15:43:08 UTC (rev 1053)
@@ -27,36 +27,36 @@
 if exist ..\testdata\ set srcdir=..)
 if [%srcdir%]==[] (
 if exist ..\..\testdata\ set srcdir=..\..)
-if NOT exist "%srcdir%\testdata\" (
+if NOT exist %srcdir%\testdata\ (
 Error: echo distribution testdata folder not found!
 call :conferror
 exit /b 1
 goto :eof
 )


-if "%pcretest%"=="" set pcretest=.\pcretest.exe
+if [%pcretest%]==[] set pcretest=.\pcretest.exe

echo source dir is %srcdir%
echo pcretest=%pcretest%

-if NOT exist "%pcretest%" (
-echo Error: "%pcretest%" not found!
+if NOT exist %pcretest% (
+echo Error: %pcretest% not found!
echo.
call :conferror
exit /b 1
)

-"%pcretest%" -C linksize >NUL
+%pcretest% -C linksize >NUL
set link_size=%ERRORLEVEL%
-"%pcretest%" -C pcre8 >NUL
+%pcretest% -C pcre8 >NUL
set support8=%ERRORLEVEL%
-"%pcretest%" -C pcre16 >NUL
+%pcretest% -C pcre16 >NUL
set support16=%ERRORLEVEL%
-"%pcretest%" -C utf >NUL
+%pcretest% -C utf >NUL
set utf=%ERRORLEVEL%
-"%pcretest%" -C ucp >NUL
+%pcretest% -C ucp >NUL
set ucp=%ERRORLEVEL%
-"%pcretest%" -C jit >NUL
+%pcretest% -C jit >NUL
set jit=%ERRORLEVEL%

if %support8% EQU 1 (
@@ -216,21 +216,21 @@
)

 echo Test %1: %3
-"%pcretest%" %mode% %4 %5 %6 %7 %8 %9 "%srcdir%\testdata\%testinput%">%2%bits%\%testoutput%
+%pcretest% %mode% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% >%2%bits%\%testoutput%
 if errorlevel 1 (
   echo.          failed executing command-line:
-  echo.            "%pcretest%" %mode% %4 %5 %6 %7 %8 %9 "%srcdir%\testdata\%testinput%"^>%2%bits%\%testoutput%
+  echo.            %pcretest% %mode% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% ^>%2%bits%\%testoutput%
   set failed="yes"
   goto :eof
 )


 if [%1]==[11] (
-  fc /n "%srcdir%\testdata\%testoutput%-%bits%" "%2%bits%\%testoutput%">NUL
+  fc /n %srcdir%\testdata\%testoutput%-%bits% %2%bits%\%testoutput% >NUL
 ) else (
-  fc /n "%srcdir%\testdata\%testoutput%" "%2%bits%\%testoutput%">NUL
+  fc /n %srcdir%\testdata\%testoutput% %2%bits%\%testoutput% >NUL
 )
 if errorlevel 1 (
-  echo.          failed comparison: fc /n "%srcdir%\testdata\%testoutput%" "%2%bits%\%testoutput%"
+  echo.          failed comparison: fc /n %srcdir%\testdata\%testoutput% %2%bits%\%testoutput%
   if [%1]==[2] (
     echo.
     echo ** Test 2 requires a lot of stack. PCRE can be configured to
@@ -370,7 +370,7 @@
   echo Test 14 Skipped when running 16-bit tests.
   goto :eof
 )
-  copy /Y "%srcdir%\testdata\saved16" testsaved16
+  copy /Y %srcdir%\testdata\saved16 testsaved16
   call :runsub 14 testout "Specials for the basic 8-bit library" -q
   call :runsub 14 testoutstudy "Test with Study Override" -q -s
   if %jit% EQU 1 call :runsub 14 testoutjit "Test with JIT Override" -q -s+
@@ -409,9 +409,9 @@
   echo Test 17 Skipped when running 8-bit tests.
   goto :eof
 )
-  copy /Y "%srcdir%\testdata\saved8" testsaved8
-  copy /Y "%srcdir%\testdata\saved16LE-1" testsaved16LE-1
-  copy /Y "%srcdir%\testdata\saved16BE-1" testsaved16BE-1
+  copy /Y %srcdir%\testdata\saved8 testsaved8
+  copy /Y %srcdir%\testdata\saved16LE-1 testsaved16LE-1
+  copy /Y %srcdir%\testdata\saved16BE-1 testsaved16BE-1
   call :runsub 17 testout "Specials for the basic 8-bit library" -q
   call :runsub 17 testoutstudy "Test with Study Override" -q -s
   if %jit% EQU 1 call :runsub 17 testoutjit "Test with JIT Override" -q -s+
@@ -426,8 +426,8 @@
   echo Test 18 Skipped due to absence of UTF-8 support.
   goto :eof
 )
-  copy /Y "%srcdir%\testdata\saved16LE-2" testsaved16LE-2
-  copy /Y "%srcdir%\testdata\saved16BE-2" testsaved16BE-2
+  copy /Y %srcdir%\testdata\saved16LE-2 testsaved16LE-2
+  copy /Y %srcdir%\testdata\saved16BE-2 testsaved16BE-2
   call :runsub 18 testout "Specials for the basic 8-bit library" -q
   call :runsub 18 testoutstudy "Test with Study Override" -q -s
   if %jit% EQU 1 call :runsub 18 testoutjit "Test with JIT Override" -q -s+