[CMake] Problem with library prefix/suffix when cross compiling.
Eric Noulard
eric.noulard at gmail.com
Thu Nov 16 18:05:11 EST 2006
2006/11/16, Peter Visser <pervulgo at gmail.com>:
> The great thing is that cross compiling was very simple with to setup with
> CMake in my case, I didn't require a "special" CMakeLists.txt.
>
> All I do is create a file e.g. "setmingw" with:
>
> export CC=i586-mingw32msvc-gcc
[...]
Ok now I see what you did.
> Also I didn't know the option CROSS_MINGW32, however it setting the
> option doesn't solve the problem.
I (wrongly) assumed that you had set such kind of OPTION
in order to handle cross-compiling.
I was wrong.
CROSS_MINGW32 was an example not a standard CMake option.
>
>
>
> On 11/16/06, Eric Noulard <eric.noulard at gmail.com> wrote:
> > I am really interested in getting sample CMakeLists.txt
> > since I just wanted to do what you've done, i.e. cross-compiling
> > for win32 under linux.
> >
> > You should know that CMake does not currently support cross-compiling.
> > See
> >
> http://www.cmake.org/pipermail/cmake/2006-September/010959.html
> > or
> >
> http://www.cmake.org/pipermail/cmake/2006-September/010946.html
> >
> > For your "problem" I think you may try this in your
> > project CMakeLists.txt
> >
> > IF (UNIX)
> > IF (CROSS_MINGW32)
> > SET(MY_TARGETLIB_PREFIX "")
> > SET(MY_TARGETLIB_SUFFIX ".dll")
> > ELSE (CROSS_MINGW32)
> > SET(MY_TARGETLIB_PREFIX "lib")
> > SET(MY_TARGETLIB_SUFFIX ".so")
> > ENDIF (CROSS_MINGW32)
> > ENDIF (UNIX)
> >
> > I assume
> > OPTION(CROSS_MINGW32 "Cross compile Win32 using mingw32" OFF)
> >
> > was set ON for mingw32 cross compiling
> > and OFF for Linux "native" compiling.
> >
> > Then use your MY_TARGETLIB_xxx
> > in all other places:
> > SET_TARGET_PROPERTIES(ex1
> > PROPERTIES
> > PREFIX $(MY_TARGETLIB_PREFIX)
> > SUFFIX $(MY_TARGETLIB_SUFFIX)
> > )
> >
> > 2006/11/16, Peter Visser <pervulgo at gmail.com>:
> > > Hi,
> > >
> > > I have a working build under win32 with MSYS/MINGW, now I would like to
> > > cross-compile code for win32 with mingw from linux with by using the
> same
> > > CMakelists.txt files. It almost works, the problem is that the shared
> > > libraries are not named "myex.dll" but " libmyex.so". By using the
> following
> > > command for all the libraries it can be solved:
> > >
> > > SET_TARGET_PROPERTIES(ex1
> > >
> > > PROPERTIES PREFIX ""
> > >
> SUFFIX
> > > ".dll"
> > > )
> > >
> > > However, now I have to change the CMakelist.txt in all the
> subdirectories
> > > and lose the ability to compile natively for linux (without adding an
> > > IF(UNIX) around the SET_TARGET_PROPERTIES).
> > >
> > > Is there a global option to set the PREFIX and SUFFIX, set the
> BUILD_TARGET
> > > to win32 or something alike?
> > >
> > > I tried setting:
> > >
> > > SET(UNIX FALSE)
> > > SET(MINGW TRUE)
> > > SET(WIN32 TRUE)
> > >
> > > But that doesn't help.
> > >
> > > Any help is appreciated,
> > >
> > > Peter.
> > > _______________________________________________
> > > CMake mailing list
> > > CMake at cmake.org
> > > http://www.cmake.org/mailman/listinfo/cmake
> > >
> > >
> >
> >
> > --
> > Erk
> > _______________________________________________
> > CMake mailing list
> > CMake at cmake.org
> > http://www.cmake.org/mailman/listinfo/cmake
> >
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
>
--
Erk
More information about the CMake
mailing list