[CMake] Static linking and find_library
S. Levent Yilmaz
leventyilmaz at gmail.com
Wed May 13 18:28:44 EDT 2009
> > I don't think direct definition of CMAKE_SYSTEM_NAME is supported.
> > It's supposed to be detected and set by the platform files. Only
> > through a toolchain file should it be customized. (Alex?)
>
> Well, after all, it's just a cmake variable, so it can also be set from the
> command line.
Quoting http://www.vtk.org/Wiki/CMake_Cross_Compiling
>
> -- The toolchain file --
> Defining all the variables mentioned above using -DCMAKE_SYSTEM_NAME etc.
would be quite tedious and error prone. To make things easier, there is
another cmake variable you can set:
>
so, it just convenience (and good design) to put these in a file, right?
> [..] The toolchain file is just supposed to
> > specify some very basic information which triggers loading of platform-
> > specific configuration.
>
> Yes.
> It should only preset the things cmake can not automatically detect when
> cross
> compiling, i.e. the target system name, where the target environment is
> located, and which compiler to use.
Can I argue that the need to build a statically linked executable is also a
cross compiling issue? If yes, then toolchain file should also be able to
set this..
> > The documentation you reference at
> >
> > http://www.cmake.org/Wiki/CMake_Cross_Compiling
> >
> > says that a ${CMAKE_SYSTEM_NAME}.cmake module is mandatory.
> > The module will be loaded after CMakeGenericSystem.cmake so it gets
> > the final say in values of variables like CMAKE_FIND_LIBRARY_SUFFIXES.
> > This is why it works for Catamount. You need to create a module like
> > Catamount.cmake for your own target platform, and put it somewhere
> > referenced by CMAKE_MODULE_PATH (Alex, can you confirm this?).
>
> Yes.
>
> Alex
>
So, to sum it up, is our only option to force find_library() to seek out
static libs is to create a Platform module?
- Levent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090513/3551d116/attachment.htm>
More information about the CMake
mailing list