#copyright Omar Andres Zapata Mesa for Mingw Env project under gpl or lgpl lincense MESSAGE(STATUS "Searching MingwEnv: mingwrt-dll w32api directx binutils gcc-gmp gcc-mpfr gcc-tdm gcc-pthreads gcc") #set cmake crosscompiling mode #SET(CMAKE_CROSSCOMPILING TRUE) #serach into framework and before in standarts paths SET(CMAKE_SYSTEM_FRAMEWORK_PATH FIRST) #you can change MingwEnv var to search in paths, like normal cmake SET(MINGW_ENV_ROOT_PATH /opt/mingw) SET(MINGW_ENV_USR_PATH ${MINGW_ENV_ROOT_PATH}/usr) SET(MINGW_ENV_BIN_PATH ${MINGW_ENV_ROOT_PATH}/bin) SET(MINGW_ENV_LIB_PATH ${MINGW_ENV_ROOT_PATH}/i686-pc-mingw32/lib) SET(MINGW_ENV_INCLUDE_PATH ${MINGW_ENV_ROOT_PATH}/i686-pc-mingw32/include) #search header for c and c++ FIND_PATH(MINGW_ENV_INCLUDE_DIR NAMES accctrl.h d3dcaps.h direct.h dsound.h imagehlp.h lmmsg.h mswsock.h profile.h sched.h svcguid.h winldap.h aclapi.h d3d.h dirent.h dsquery.h imm.h lmremutl.h multimon.h profil.h schnlsp.h tchar.h winnetwk.h aclui.h d3drmdef.h dir.h dsrole.h initguid.h lmrepl.h nb30.h prsht.h scrnsave.h time.h winnls.h adsprop.h d3drm.h dlgs.h dvdevcod.h intshcut.h lmserver.h nddeapi.h psapi.h sddl.h tlhelp32.h winnt.h afxres.h d3drmobj.h dls1.h dvdmedia.h inttypes.h lmshare.h nspapi.h pshpack1.h search.h tmschema.h winperf.h amaudio.h d3drmwin.h dls2.h dv.h io.h lmsname.h ntdef.h pshpack2.h secext.h unistd.h winreg.h amvideo.h d3dtypes.h dmdls.h dvoice.h ipexport.h lmstats.h ntdll.h pshpack4.h security.h unknwn.h winresrc.h assert.h d3dvec.inl dmerror.h dvp.h iphlpapi.h lmsvc.h ntdsapi.h pshpack8.h semaphore.h userenv.h winsnmp.h audevcod.h d3dx8core.h dmksctrl.h dx7todx8.h ipifcons.h lmuseflg.h ntdsbcli.h pthread.h servprov.h usp10.h winsock2.h aviriff.h d3dx8effect.h dmodshow.h dxerr8.h ipinfoid.h lmuse.h ntldap.h qedit.h setjmp.h utime.h winsock.h aygshell.h d3dx8.h dmo.h dxerr9.h iprtrmib.h lmwksta.h ntsecapi.h rapi.h setupapi.h uxtheme.h winspool.h basetsd.h d3dx8math.h dmoimpl.h dxfile.h iptypes.h locale.h ntsecpkg.h rasdlg.h share.h values.h winsvc.h basetyps.h d3dx8math.inl dmoreg.h dxtrans.h ipxconst.h lzexpand.h oaidl.h raserror.h shellapi.h varargs.h winuser.h bdatypes.h d3dx8mesh.h dmort.h dxva.h ipxrtdef.h malloc.h objbase.h ras.h shldisp.h vfw.h winver.h cderr.h d3dx8shape.h dmplugin.h edevdefs.h ipxtfflt.h mapi.h objfwd.h rassapi.h shlguid.h vidcap.h ws2spi.h cguid.h d3dx8tex.h dmusbuff.h errno.h isguids.h math.h objidl.h reason.h shlobj.h vmr9.h ws2tcpip.h cmnquery.h d3dxcore.h dmusicc.h errorrep.h ks.h mbctype.h objsafe.h regstr.h shlwapi.h vptype.h wsahelp.h comcat.h d3dxerr.h dmusicf.h errors.h ksmedia.h mbstring.h objsel.h richedit.h signal.h w32api.h wsipx.h commctrl.h d3dx.h dmusici.h evcode.h largeint.h mciavi.h ocidl.h richole.h snmp.h wchar.h wsnetbs.h commdlg.h d3dxmath.h dmusics.h excpt.h libgen.h mcx.h odbcinst.h rmxfguid.h specstrings.h wctype.h wtsapi32.h complex.h d3dxmath.inl docobj.h exdisp.h limits.h mem.h ole2.h rmxftmpl.h sqlext.h winable.h wtypes.h conio.h d3dxshapes.h dos.h exdispid.h lmaccess.h memory.h ole2ver.h routprot.h sql.h winbase.h xprtdefs.h control.h d3dxsprite.h dpaddr.h fcntl.h lmalert.h mgm.h oleacc.h rpcdce2.h sqltypes.h winber.h zmouse.h cplext.h dbt.h dplay8.h fenv.h lmapibuf.h mgmtapi.h oleauto.h rpcdce.h sqlucode.h wincon.h cpl.h dde.h dplay.h files lmat.h _mingw.h olectl.h rpcdcep.h sspi.h wincrypt.h ctype.h ddeml.h dplobby8.h float.h lmaudit.h mlang.h olectlid.h rpc.h stdint.h windef.h custcntl.h ddrawex.h dplobby.h fltdefs.h lmbrowsr.h mmreg.h oledlg.h rpcndr.h stdio.h windns.h d3d8caps.h ddraw.h dsadmin.h getopt.h lmchdev.h mmsystem.h ole.h rpcnsi.h stdlib.h windows.h d3d8.h ddstream.h dsclient.h gmon.h lmconfig.h mpegtype.h oleidl.h rpcnsip.h stm.h windowsx.h d3d8types.h devguid.h dsetup.h httpext.h lmcons.h mprapi.h pbt.h rpcnterr.h string.h winerror.h d3d9caps.h dhcpcsdk.h dsgetdc.h icm.h lmerr.h mq.h poppack.h rpcproxy.h strings.h wingdi.h d3d9.h dinputd.h dshowasf.h idispids.h lmerrlog.h msacm.h powrprof.h rtutils.h strmif.h wininet.h d3d9types.h dinput.h dshow.h il21dec.h lm.h mshtml.h process.h schannel.h subauth.h winioctl.h ddk/atm.h ddk/hidpi.h ddk/mountmgr.h ddk/ntapi.h ddk/ntddk.h ddk/ntddtape.h ddk/pfhook.h ddk/tdi.h ddk/usbdi.h ddk/win2k.h ddk/batclass.h ddk/hidsdi.h ddk/ndisguid.h ddk/ntdd8042.h ddk/ntddmou.h ddk/ntddtdi.h ddk/poclass.h ddk/tdiinfo.h ddk/usb.h ddk/winddi.h ddk/cfg.h ddk/hidusage.h ddk/ndis.h ddk/ntddbeep.h ddk/ntddndis.h ddk/ntddvdeo.h ddk/scsi.h ddk/tdikrnl.h ddk/usbioctl.h ddk/winddk.h ddk/cfgmgr32.h ddk/kbdmou.h ddk/ndistapi.h ddk/ntddcdrm.h ddk/ntddpar.h ddk/ntddvol.h ddk/scsiscan.h ddk/tdistat.h ddk/usbiodef.h ddk/winnt4.h ddk/d4drvif.h ddk/mcd.h ddk/ndiswan.h ddk/ntddcdvd.h ddk/ntddpcm.h ddk/ntifs.h ddk/scsiwmi.h ddk/tvout.h ddk/usbscan.h ddk/winxp.h ddk/d4iface.h ddk/miniport.h ddk/netevent.h ddk/ntddchgr.h ddk/ntddscsi.h ddk/ntpoapi.h ddk/smbus.h ddk/upssvc.h ddk/usbuser.h ddk/ws2san.h ddk/ddkmapi.h ddk/minitape.h ddk/netpnp.h ddk/ntdddisk.h ddk/ntddser.h ddk/ntstatus.h ddk/srb.h ddk/usb100.h ddk/videoagp.h ddk/xfilter.h ddk/hidclass.h ddk/mountdev.h ddk/newdev.h ddk/ntddkbd.h ddk/ntddstor.h ddk/parallel.h ddk/storport.h ddk/usbcamdi.h ddk/video.h GL/glext.h GL/gl.h GL/glu.h sys/fcntl.h sys/file.h sys/locking.h sys/param.h sys/stat.h sys/timeb.h sys/time.h sys/types.h sys/unistd.h sys/utime.h PATHS ${MINGW_ENV_USR_PATH}/i686-pc-mingw32/include ) #search libs FIND_LIBRARY(MINGW_ENV_LIBRARY_DIR NAMES aclui advapi32 apcups avicap32 avifil32 bthprops cap cfgmgr32 coldname comctl32 comdlg32 crtdll crypt32 ctl3d32 d3d8 d3d9 d3dim d3drm d3dx8d d3dx9d d3dxof ddraw dhcpcsvc dinput8 dinput dlcapi dmoguids dnsapi dplayx dpnaddr dpnet dpnlobby dpvoice dsetup dsound dxapi dxerr8 dxerr9 dxguid faultrep gdi32 glaux glu32 gmon hal hid hidparse iberty icmui igmpagnt imagehlp imm32 iphlpapi kernel32 ksproxy ksuser largeint lz32 m mapi32 mcd mfcuia32 mgmtapi mingw32 mingwex mingwthrd moldname70 moldname70d moldname71 moldname71d moldname80 moldname80d moldname90 moldname90d moldname moldnamed mpr mprapi mqrt msacm32 mscms msdmo msimg32 msvcp60 msvcr70 msvcr70d msvcr71 msvcr71d msvcr80 msvcr80d msvcr90 msvcr90d msvcrt msvcrtd msvfw32 mswsock nddeapi ndis netapi32 newdev ntdll ntoskrnl odbc32 odbccp32 ole32 oleacc oleaut32 olecli32 oledlg olepro32 olesvr32 opengl32 penwin32 pkpd32 powrprof psapi pthread quartz rapi rasapi32 rasdlg rpcdce4 rpcns4 rpcrt4 rtm rtutils scrnsave scrnsavw scsiport secur32 setupapi shell32 shfolder shlwapi snmpapi strmiids svrapi tapi32 tdi th32 thunk32 url usbcamd2 usbcamd user32 userenv usp10 uuid uxtheme vdmdbg version vfw32 videoprt win32k win32spl wininet winmm winspool winstrm wldap32 wow32 ws2_32 wsnmp32 wsock32 wst wtsapi32 PATHS ${MINGW_ENV_LIB_PATH} ) #search gcc compilers FIND_PROGRAM(MINGW_ENV_BINARIES_DIR NAMES i686-pc-mingw32-addr2line i686-pc-mingw32-dlltool i686-pc-mingw32-gcov i686-pc-mingw32-objdump i686-pc-mingw32-strip i686-pc-mingw32-ar i686-pc-mingw32-dllwrap i686-pc-mingw32-gfortran i686-pc-mingw32-pkg-config i686-pc-mingw32-windmc i686-pc-mingw32-as i686-pc-mingw32-g++ i686-pc-mingw32-gprof i686-pc-mingw32-ranlib i686-pc-mingw32-windres i686-pc-mingw32-c++ i686-pc-mingw32-gcc i686-pc-mingw32-ld i686-pc-mingw32-readelf i686-pc-mingw32-c++filt i686-pc-mingw32-gcc-4.4.0 i686-pc-mingw32-nm i686-pc-mingw32-size i686-pc-mingw32-cpp i686-pc-mingw32-gccbug i686-pc-mingw32-objcopy i686-pc-mingw32-strings PATHS ${MINGW_ENV_BIN_PATH} /usr/local/bin /usr/bin) IF (MINGW_ENV_INCLUDE_DIR) MESSAGE(STATUS "Headers: ${MINGW_ENV_INCLUDE_DIR}") SET(CMAKE_CXX_FLAGS -I${MINGW_ENV_INCLUDE_DIR}) SET(CMAKE_C_FLAGS -I${MINGW_ENV_INCLUDE_DIR}) ENDIF (MINGW_ENV_INCLUDE_DIR) IF (MINGW_ENV_LIBRARY_DIR) MESSAGE(STATUS "Library : ${MINGW_ENV_LIBRARY_DIR}") ENDIF (MINGW_ENV_LIBRARY_DIR) #setting binaries variable for cmake IF (MINGW_ENV_BIN_DIR) MESSAGE(STATUS "BINARIES : ${MINGW_ENV_BIN_DIR}") SET(CMAKE_RANLIB ${MINGW_ENV_BIN_DIR}/i686-pc-mingw32-ranlib) SET(CMAKE_CXX_COMPILER ${MINGW_ENV_BIN_DIR}/i686-pc-mingw32-g++) SET(CMAKE_C_COMPILER ${MINGW_ENV_BIN_DIR}/i686-pc-mingw32-gcc) SET(CMAKE_AR ${MINGW_ENV_BIN_DIR}/i686-pc-mingw32-ar) ENDIF (MINGW_ENV_BIN_DIR) IF (MINGW_ENV_INCLUDE_DIR AND MINGW_ENV_LIBRARY_DIR AND MINGW_ENV_BINARY_DIR) SET(MINGW_ENV_FOUND TRUE) ENDIF (MINGW_ENV_INCLUDE_DIR AND MINGW_ENV_LIBRARY_DIR AND MINGW_ENV_BINARY_DIR) IF (MINGW_ENV_FOUND) IF (NOT MingwEnv_FIND_QUIETLY) MESSAGE(STATUS "Found MingwEnv: ${CSPICE_INCLUDE_DIR} ${CSUPPORT_LIBRARY} ${CSPICE_LIBRARY}") ENDIF (NOT CSpice_FIND_QUIETLY) ELSE (MINGW_ENV_FOUND) IF (MingwEnv_FIND_REQUIRED) MESSAGE(FATAL_ERROR "Could not find MingwEnv Download from\n http://www.nongnu.org/mingw-cross-env/") ENDIF (MingwEnv_FIND_REQUIRED) ENDIF (MINGW_ENV_FOUND)