[CMake] Question about distribution questions

Andreas Pakulat apaku at gmx.de
Fri Sep 21 09:02:53 EDT 2007


On 21.09.07 14:26:58, Joachim Ziegler wrote:
> Dizzy wrote:
> >So you said you want some package made of some files, but a package means some 
> >files that eventually will be on the system in some locations (when the 
> >package is installed) so with cmake INSTALL() commands you specify how are 
> >those files to be installed (if the user would run a hypotethical "make 
> >install") and CPack will use that information to create the package ("CPack" 
> >has to know in what locations what files do you have, those are automatically 
> >determined based on the installation rules created with INSTALL).
> 
> Your last statement is exactly what I do not understand in the INSTALL command: 
> You have to say in what locations what files you have *AND* they are 
> automatically determined? (Isn't this a contradiction?)
> 
> Say, for an easy example, that i want to have the files installed in the 
> directory where I do the build (or subdirectory).

No you don't. Thats the builddirectory, where the result of building
your application is put (including Makefile's, object files and what
not). The installation directory is something different, its the place
from where you and other users on the system will use the application. 

> What would be the command to write in CMakeLists.txt?
> 
> INSTALL(FILES a.h a.cpp, b.h b.cpp main.cpp DESTINATION .)

That would install the sources, but I doubt you want that. You want to
list data files with INSTALL(FILES ...), the application can be
installed with INSTALL(TARGETS <app_target> DESTINATION bin)

Then when you run cmake you can say cmake
-DCMAKE_INSTALL_PREFIX=/usr/local/yourapp and cmake will install the
data files into that directory and the binary into
/usr/local/yourapp/bin when you run make install. That works the same
way as configure's --prefix option. (The default is /usr/local IIRC).

Andreas

-- 
Chicken Little was right.


More information about the CMake mailing list