[CMake] Problem with library prefix/suffix when cross compiling.

Peter Visser pervulgo at gmail.com
Fri Nov 17 12:45:18 EST 2006


Hi,

I now have a working example to cross compile the CMake example (
http://www.cmake.org/HTML/Examples.html) with MINGW under linux for windows.
Unfortunately it requires a "small" replace in a build.make file, I wasn't
able to figure it out completely in CMake.

To get the example working I changed the CMakelists.txt in the Hello subdir
to the following:
add_library (Hello SHARED hello.cxx)
SET_TARGET_PROPERTIES(Hello
                                                   PROPERTIES SUFFIX ".dll"
                                                   )

The problem when building this example is that by adding the suffix for some
reason (probably intended behaviour) the linker options are changed from
"-lHello" to "-llibHello.dll" which cannot be found.

By changing it back to "-lHello" in Demo/CMakeFiles/helloDemo.dir/build.make
the example builds ok and runs ok.

I took a brief look at the platfrom files but could not find where the
libraries suffixes and prefixes are set. (I probably don't know what to look
for exactly.)

For now, I'll write a small replace script that replaces the "-llibxxx.dll"
with  "-lxxx"  in the build.make files and add a "IF (CROSS_MINGW32)" as
suggested. Thanks for pointing out that CROSS_MINGW32 is an example option.
(I misread the example probably due to wishful thinking and lack of coffee.)



Thanks for the help and suggestions,

Peter.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20061117/0cd3bac7/attachment.html


More information about the CMake mailing list