Re: [pcre-dev] Testing CMake

Kezdőlap
Üzenet törlése
Szerző: Daniel Richard G.
Dátum:  
Címzett: pcre-dev
Tárgy: Re: [pcre-dev] Testing CMake
On Fri, 2007 Mar 30 15:27:52 +0100, Philip Hazel wrote:
> I installed CMake on my box to try out your CMakeLists.txt file, Daniel,
> to see if I could easily incorporate a test into my standard tests.


Thanks for giving it a test run! I didn't think you were interested in
trying it yourself.

> 1. It complained that I had installed CMake 2.4.3 but it wanted 2.4.6.
> What I had installed was Gentoo's current release of CMake. I ignored
> that warning.


Hm, 2.4.6 has been out for a while now. And, as you noticed, some
not-so-insignificant features tend to get added between point revisions...

> 2. However, it didn't like ELSEIF in the CMakeLists.txt file. As there
> were only a very few of these, I edited the file to use nested IFs
> instead, and it was happy with that. If ELSEIF is a relatively new
> thing, it might be best to avoid it for a while.


Eeegh... let's go with parallel IFs there. If-then-else-if is inelegant, to
say the least, and here we don't really have mutual-exclusivity issues.
(Unless Cygwin and/or MSYS register as both UNIX and WIN32...)

> 3. After that, running "cmake ." went fine, and quickly. As did a
> subsequent "make". I have to confess to being impressed by the speed.


So the ANSI-colorified build messages didn't do anything for you? :-)

> After some faffing, I managed to edit CMakeLists.txt so that it would
> run, and I added the pcregrep test too. I ended up with:
>
> ADD_TEST(test1 sh -c "srcdir=${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/RunTest")
> ADD_TEST(test2 sh -c "srcdir=${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/RunGrepTest")


I found a better approach, that involves writing out a CTestCustom.ctest
file containing e.g.

    # This is a generated file.
    SET(ENV{srcdir} /tmp/pcre-7.1-RC4)


This will work equally well on Windows (i.e. where no /bin/sh is
available), and can be more easily expanded to include more variables.

(As it happens, I think we're going to need variables specifying paths to
the actual binaries being used. Have a look at my revised RunTest.bat
script for an example.)

Note to self: Remember to add this tidbit of information to the FAQ on the
CMake wiki... I really had to dig for it.

> 6. I noticed, however, that though it built the C++ wrapper, it didn't
> build the C++ unittest files. I could probably figure out how to do
> that, but I decided to wait till you have commented.


I've added those in, and they now get invoked as part of the test suite.


--Daniel


-- 
NAME   = Daniel Richard G.       ##  Remember, skunks       _\|/_  meef?
EMAIL1 = skunk@???        ##  don't smell bad---    (/o|o\) /
EMAIL2 = skunk@???      ##  it's the people who   < (^),>
WWW    = http://www.******.org/  ##  annoy them that do!    /   \
--
(****** = site not yet online)