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

Eduard Bloch edi at gmx.de
Thu Aug 24 10:43:25 EDT 2006


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?

Nasty things:

 - CMAKE_INSTALL_PREFIX handling is inconsistent. Using
   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.


More information about the CMake mailing list