Am Sonntag 28 Februar 2010 10:31:57 schrieb Giampiero Gabbiani: > 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?
You could use a variable to represent the directory. This would depend on the existence of lib64/ (not all have this as directory, on Debian it's just a compatibility link to lib/) and on SIZEOF_VOID_P being 8: set (LIBRARY_INSTALL_DIR lib) if (EXISTS "${CMAKE_INSTALL_PREFIX}/lib32/" AND CMAKE_SIZEOF_VOID_P EQUAL 4) set (LIBRARY_INSTALL_DIR lib32) elif (EXISTS "${CMAKE_INSTALL_PREFIX}/lib64/" AND CMAKE_SIZEOF_VOID_P EQUAL 8) set (LIBRARY_INSTALL_DIR lib64) endif () Or let the user set it. HS _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake