[CMake] How can I place a 64bit library build into /usr/lib64?

Theodore Papadopoulo Theodore.Papadopoulo at inria.fr
Mon Jul 29 10:04:47 EDT 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

cmake knows the difference for its internal search for libraries...
I use this knowledge in the following manner:

get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)

if ("${LIB64}" STREQUAL "TRUE")
    set(LIBSUFFIX 64)
else()
    set(LIBSUFFIX "")
endif()

set(INSTALL_LIB_DIR     lib${LIBSUFFIX} CACHE PATH "Installation
directory for libraries")
mark_as_advanced(INSTALL_LIB_DIR)


and then using INSTALL_LIB_DIR everywhere it is needed.

It would be good if cmake was automatically doing such an adjustement....

Hope this helps.

	Theo.

On 07/29/2013 01:49 PM, Gregor Jasny wrote:
> Hi Zack,
> 
> On 7/28/13 5:20 AM, Zack Perry wrote:
>> I have been trying to build libc++ <http://libc++.llvm.org/> on a
>> RHEL 6.4 64bit box. The library comes with a CMakeLists.txt 
>> <http://llvm.org/svn/llvm-project/libcxx/trunk/CMakeLists.txt>.
>> 
>> Running the following:
>> 
>> CC=clang CXX=clang++ cmake -G "Unix Makefiles" 
>> -DLIBCXX_CXX_ABI=libcxxabi 
>> -DLIBCXX_LIBCXXABI_INCLUDE_PATHS="/usr/include/c++abi/3.3/" 
>> -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
>> -DLIB_SUFFIX=64 $HOME/clang3.3/libs/libcxx
>> 
>> 
>> It can successfully generate a Makefile in the build
>> subdirectory (it's an out-of-source build).
>> 
>> By adding a few CPack related statements, I also can create a
>> RPM using 'make package'.  But, a rpm -qlp
>> libcxx-3-3-0.el6.x86_64.rpm shows that the shared library is
>> installed in /usr/lib, not /usr/lib64, as 64bit libraries on RHEL
>> 6.x should go.
> 
> Not sure if this will help when building clang:
> 
> If you include("GNUInstallDirs") you'll get a LIBRDIR variable
> defined that will be lib, lib64, or lib/<multiarch-tuple> depending
> on your distribution and architecture.
> 
> You could use this variable instead of a generic "lib" in the
> target install parameters.
> 
> Thanks, Gregor
> 
> --
> 
> Powered by www.kitware.com
> 
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Kitware offers various services to support the CMake community. For
> more information on each offering, please visit:
> 
> CMake Support: http://cmake.org/cmake/help/support.html CMake
> Consulting: http://cmake.org/cmake/help/consulting.html CMake
> Training Courses: http://cmake.org/cmake/help/training.html
> 
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe: 
> http://www.cmake.org/mailman/listinfo/cmake

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlH2dn8ACgkQEr8WrU8nPV0xkwCeM0brREPakjKSnrY6nnwffysQ
U18An0fJZA1AIvoohOE8ZekW0/2AvkQV
=3agR
-----END PGP SIGNATURE-----


More information about the CMake mailing list