Hi there 

I use MinGW to cross-compile for Windows on Linux.

I have a file 'file.cmake' in the root dir of the source tarball.

In the bulid dir I call cmake this way:

$> cmake -DCMAKE_TOOLCHAIN_FILE=../file.cmake -DWITH_EXAMPLES=OFF 
-DCMAKE_BUILD_TYPE=Debug -DOPENSSL_INCLUDE_DIR=/usr/local/include .. 

file.cmake has this content:

SET(CMAKE_SYSTEM_NAME Windows)
SET(COMPILER_PREFIX "i686-w64-mingw32")
SET(CMAKE_C_COMPILER /usr/bin/${COMPILER_PREFIX}-gcc-posix)
SET(CMAKE_CXX_COMPILER /usr/bin/${COMPILER_PREFIX}-g++-posix)
SET(CMAKE_RC_COMPILER /usr/bin/${COMPILER_PREFIX}-windres)
SET(CMAKE_RANLIB "/usr/bin/${COMPILER_PREFIX}-ranlib")
SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX} /usr/local/ssl 
/usr/local/${COMPILER_PREFIX})
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

Maybe this helps as a starting point.

Good luck
Till

July 18, 2025 12:18 AM, carl.mo...@l3harris.com 
(mailto:carl.mo...@l3harris.com) wrote:
        I only use Linux every 5th or 6th project – so I’m not very experienced 
with the more complex cmake files.

        I’m simply trying to change the compiler your build system uses to the 
cross-compiler I need for my Enclustra SOM development kit.

        Can you please help.

        Thank you.

        Carl L. Mohre II

        L5 Lead Electrical Engineer
AHM IRAD Software Systems & Embedded Software Engineer

        SPACE & AIRBORNE SYSTEMS / L3HARRIS TECHNOLOGIES

        t +1 321 727 5794 / m +1 321 288 5266

        L3Harris.com / carl.mo...@l3harris.com (mailto:carl.mo...@l3harris.com)

        2400 Palm Bay Rd NE / Palm Bay, FL 32905 / USA

         (http://www.l3harris.com/) 
CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of 
the intended recipient and may contain material that is proprietary, 
confidential, privileged or otherwise legally protected or restricted under 
applicable government laws. Any review, disclosure, distributing or other use 
without expressed permission of the sender is strictly prohibited. If you are 
not the intended recipient, please contact the sender and delete all copies 
without reading, printing, or saving.

Reply via email to