[Cmake] backwards compatibility problem with CMake1.4

Ken Martin ken.martin at kitware.com
Tue Jul 30 14:20:04 EDT 2002


Is it a Bug or a Feature, who can really say :-) OK, mostly it is a
bug.  While your case is simple why it doesn't work is a little
complex. The old CMake used to put entries into the cache for every
executable and library. In your case there is a cache entry called
test_vasm. When CMake 1.4 is run on a CMakeList file that does not
require CMake 1.4, then it will accept the name of a source list on
the ADD_EXECUTABLE command. It then looks up that source list to see
if it is defined (versus a file). In your case the file name is
defined because of that old cache entry. CMake then treats the value
of that cache entry as the actual file name. There are a few solutions
to this problem.

1) clean your cache (or at least remove the old test_vasm entry since
it is no longer used by CMake 1.4 and is causing the problem)

2) put a CMAKE_MINIMUM_REQUIRED(VERSION 1.4) in your CMake list file.
This shuts off some of the backwards compatibility code that causes
this side effect.

3) Put the extension on the file.

So it is a bug, but it will only happen for builds that have caches
from before CMake 1.4 and have ADD_EXECUTABLE(foo foo) commands in
them. Unfortunantly it is not easy to make cmake smart enough to
handle this case so It will probably stick around.

Thanks
Ken

> -----Original Message-----
> From: cmake-admin at public.kitware.com
> [mailto:cmake-admin at public.kitware.com]On Behalf Of Ian Scott
> Sent: Tuesday, July 30, 2002 1:32 PM
> To: Cmake at Public. Kitware. Com (E-mail)
> Subject: [Cmake] backwards compatibility problem with CMake1.4
>
>
> On Unix if you do not specify the file ending for the
> source file in an
> ADD_EXECUTABLE command, the Makefile isn't correct
>
> For example
> Replacing
>   ADD_EXECUTABLE(test_vasm test_vasm.cxx)
> with
>   ADD_EXECUTABLE(test_vasm test_vasm)
>
> causes every instance of
>    test_vasm.o
> in the produced Makefile is replaced with
>    /work/vxl/obj/isbe_apm/vasm/tests.o
> or just
>    tests.o
>
> Make then complains that there is no build rule for test.o.
> (There is no
> file called "tests.cxx" anywhere.)
> It is relatively trivial problem to fix, but if you are
> aiming for backwards
> compatibility it might be worth taking a look at. Sorry I
> didn't spot it
> earlier, but my usual platform is MSVC (which doesn't
> appear to have a
> similar problem)
> Ian.
>
>
>
> _______________________________________________
> Cmake mailing list
> Cmake at public.kitware.com
> http://public.kitware.com/mailman/listinfo/cmake




More information about the CMake mailing list