libsuffix with cmake
Andras Mantia
amantia at kde.org
Tue Apr 11 22:19:49 CEST 2006
On Tuesday 11 April 2006 23:16, William A. Hoffman wrote:
> At 02:56 PM 4/11/2006, Andras Mantia wrote:
> >No, it is not that easy, as some 64 bit systems use lib64, others
> > use lib and suffix the 32 bit libraries... I have the check written
> > in bash to detect the correct suffix, it just needs to be
> > integrated with the cmake files from KDE. The check itself in
> > automake version is:
> >
> >cat > conftest.c << EOF
> >#include <stdio.h>
> >int main() {
> > return 0;
> >}
> >EOF
> > kdelibsuff=`$CC conftest.c -o conftest.out; ldd conftest.out
> > | sed -ne '/libc.so/{
> > s,.*/lib\([[^\/]]*\)/.*,\1,
> > p
> >}'`
>
> That does not look like a very portable check.
Certainly this is for unix only.
> What if the compiler
> being used does not link to a libc.so? Also, not all unix systems
> support ldd. This looks like it will work for gcc on linux.
>
> See this table:
> http://www.cmake.org/Wiki/CMake_Platform_Dependent_Issues#The_Platfor
>ms_.2F_Compilers_Table
>
> So, I guess it is even harder... :)
Hm, yes. I only used linux and sunos (quite some time ago). In this
regard they were similar.
> I wonder if there is some other way to figure this out?
At least I would be happy to have this check for Linux only as well. But
according to some commit log, it works on *BSD as well. At least
somebody fixed the check to make it work on OpenBSD.
I couldn't find a way yet to execute some code during configure time and
reuse the result. Putting the above in an external file and running
with EXEC_PROGRAM seems to be the only way, but in that case it is not
known what is the current compiler ($CC is not defined).
Andras
--
Quanta Plus developer - http://quanta.kdewebdev.org
K Desktop Environment - http://www.kde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20060411/87d66b81/attachment.pgp
More information about the Kde-buildsystem
mailing list