[CMake] Re: [out-of-tree] install uses wrong path

Eduard Bloch edi at gmx.de
Thu Aug 24 12:07:30 EDT 2006


#include <hallo.h>
* Eduard Bloch [Thu, Aug 24 2006, 04:43:25PM]:
> Hello,
> 
> I am trying to setup a proper build system for our cdrtools fork using
> cmake 2.4-patch3. To keep the working dir clean, I decided to use
> out-of-tree builds. A generic Makefile creates the build dir, runs
> "cmake .." there and delegates the commands to "make -C build $@".
> 
> However, it creates a problem and some difficulties. Shall I open
> bugs/tickets for the issues?
> 
> Problem first:
> 
>  - install rule does not work! The build works like a charme (make -C
>    build all) but the install rule fails! Apparently it tries to copy
>    the binary from the source directory, but it is built elsewhere.
>    I tried to override some variables with -D... (PROJECT_BINARY_DIR,
>    PROJECT_BINARY_DIR, CMAKE_CURRENT_BINARY_DIR) but nothing did work.
> 
>    That confuses me. It knows where it stores the bins when building
>    them, why does install not know this locations?

It seems like install_manifest already contains hardcoded absolute
(wrong) directions when created. The workaround was adding an absolete
path based on CMAKE_BINARY_DIR to INSTALL targets:

SET(BINS_SET mkisofs/mkisofs cdrecord/wodim rscsi/rscsi readcd/readcd
mkisofs/devdump mkisofs/isodebug mkisofs/isodump
->mkisofs/isoinfo mkisofs/isovfy 3rd-party/zisofs_tools/mkzftree
cdda2wav/cdda2wav cdda2wav/pitchplay cdda2wav/readmult
->cdda2wav/cdda2mp3 cdda2wav/cdda2ogg)
FOREACH(app ${BINS_SET})
   install(PROGRAMS ${CMAKE_BINARY_DIR}/${app} DESTINATION bin)
ENDFOREACH(app ${BINS_SET})

> Nasty things:
> 
>  - CMAKE_INSTALL_PREFIX handling is inconsistent. Using

Still not happy about this and other issues.

>    DESTDIR= as make argument results in $DESTDIR/usr/local - there
>    apparently is no way to get rid of the /usr/local prefix without
>    explicitely overriding of cmake-cached vars with -D... . Eg. honoring
>    the $PREFIX variable which would override the meaning of
>    CMAKE_INSTALL_PREFIX but on the make level.
> 
>  - Documentation failure: it is not clear which things are inherited to
>    subdirectory processing when SUBDIRS(...) is used. For example, can I
>    set CMAKE_C_FLAGS in the top-level CMakeLists.txt and expect the
>    value to be exported to subdirectories (without modifying
>    CMakeLists.txt there)?
> 
>  - Documentation failure: contents of
>    http://www.cmake.org/Wiki/CMake_Useful_Variables should be mentioned
>    on the big documentation side. Currently lots of things are described
>    but I was not able to find the simple thing like setting the CFLAGS
>    by reading http://www.cmake.org/HTML/Documentation.html .
>  
>  - Can I specify some random source code with compiler flags in one
>    single test instruction? I do not like writing a dozen of small files
>    for TRY_COMPILE, embedding code looks more elegant.
> 
>  - Is there a portal, collection of additional CMake modules or so? I
>    can imagine that other people have the same difficulties and could
>    donate their solutions to public.
> 
>  - I wish there be would be a way to protect an existing Makefile from
>    beeing overwritten. Because: I use the delegating Makefile
>    mentioned above, but an accidentaly called cmake would overwrite
>    files immediately, and so my Makefile delegate would be destroyed.
> 
>  - (FAQ, but current FAQ entry is biased)
>    The possibility of having out-of-tree builds is not the ultimate
>    solution for missing "distclean" rule. Such a rule usualy does not
>    only remove binary files but also left-overs from the build system.
>    Currently it seems like CMake does not provide a facility to purge
>    all of its temporary/cached data.
> 
> Thanks,
> Eduard.
> -- 
> <mrvn> HE: oder bist du schon ins cabal eingeschworen worden?
> <HE> mrvn: Klar. Ich musste eine Hand in die Hose stecken, eine auf ein
> 	Notebook legen und laut "I agree to distribute free p0rn to our users"
> 	sagen.
> <HE> Erm. Mist. Das war die Lesbian-CABAL.

-- 
Abgesehen davon, dass die Tatatur unbenutybar ist, kann man
auch nicht mehr auf die TextßKonsolen umschalten.  Evtl. sollte
man die Mandrake nicht mit FB starten.
		-- Kester Habermann


More information about the CMake mailing list