Mailinglist Archive: opensuse-buildservice (53 mails)

< Previous Next >
Re: [opensuse-buildservice] Re: cmake and MS Windows builds
  • From: Martin Koegler <martin.koegler@xxxxxxxxx>
  • Date: Fri, 16 Nov 2018 22:02:59 +0100
  • Message-id: <20181116210259.tst6tlxipg325snm@mail.zuhause>
On Fri, Nov 16, 2018 at 11:44:33AM +0100, Roger Oberholtzer wrote:
On Thu, Nov 15, 2018 at 8:06 PM Martin Koegler <martin.koegler@xxxxxxxxx>
wrote:
Of course it would be that name. But I was curious about how a
non-cross cmake knew that you wanted to do a cross-compile for
Windows. It is running on Linux, so I would have thought that was the
default.

Setting lots options. Read /etc/rpm/macros.mingw*

For non-rpm build, I would prefer a toolchain definition:

Create toolchain definition for windows, file /inst/toolchain.def:
---------------------------------------------------------------------
# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)
SET(MSYS 1)

# which compilers to use for C and C++
SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
SET(PKG_CONFIG_EXECUTABLE i686-w64-mingw32-pkg-config)

# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 /inst)

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
---------------------------------------------------------------------

cmake -DCMAKE_TOOLCHAIN_FILE=/inst/toolchain.def ....
--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-buildservice+owner@xxxxxxxxxxxx

< Previous Next >