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 <[EMAIL PROTECTED]>:
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
[email protected]
http://www.cmake.org/mailman/listinfo/cmake
--
Erk
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake