[CMake] How to install headers in a library

Giampiero Gabbiani Giampiero at gabbiani.org
Sun Feb 28 04:31:57 EST 2010


Hi all,
I like very much the simplicity of cmake in comparison with the classic 
autotools framework, but still I have two questions concerning the porting of 
a Linux based project under cmake:

1) when defining a library (shared or static) as a project target , I expected 
that cmake would understand the architecture of the host machine and install 
conseguently the libraries (.so or .a) in the correct /lib or /lib64 path. 
Instead I noticed that I have to explicity set the destination path 

install(TARGETS <static library name> ARCHIVE DESTINATION lib64)
install(TARGETS <shared object name> LIBRARY DESTINATION lib64)

This works well on my machine (a 64 bit system) but of course will not work if 
anyone want to install on a 32 bit system.

So ... is there a way in order to let cmake automatically install on the 
correct path according with the hosting system architecture?

2) together with the resulting binaries libs (both archive and library) I want 
to install also the corrisponding header(s) in /usr/local/include path...how 
is it possible to do that?

Many thanks in advance
Giampiero


More information about the CMake mailing list