From: Sisyphus <sis...@op...> - 2010-06-21 14:45:19
|
----- Original Message ----- From: "Werner Smekal" <sm...@ia...> > This is right done in CMakeLists.txt in the main directory: > > # We need the path to the MinGW/Borland compiler in order to find > # the import libraries for system libraries. > IF(MINGW) > get_filename_component(MINGWBINPATH ${CMAKE_C_COMPILER} PATH) > set(MINGWLIBPATH ${MINGWBINPATH}/../lib > CACHE FILEPATH > DOCSTRING "Path to MinGW import libraries") > ENDIF(MINGW) > IF(BORLAND) > get_filename_component(BORLANDBINPATH ${CMAKE_C_COMPILER} PATH) > set(BORLANDLIBPATH ${BORLANDBINPATH}/../Lib/PSDK > CACHE FILEPATH > DOCSTRING "Path to Borland import libraries") > ENDIF(BORLAND) Yes, I've just been playing with that. Changing set(MINGWLIBPATH ${MINGWBINPATH}/../lib to set(MINGWLIBPATH ${MINGWBINPATH}/../mingw/lib certainly works. But it's not portable, as ${MINGWBINPATH}/../mingw/lib is not always the correct location. > I think you just need to add ${MINGWBINPATH}/../mingw/lib to > MINGWLIBPATH since this is a list anyway (I hope). Oh, it's a *list* ? Lemme see .... so it is ! Wow ... that makes it *so* much easier. If I change that line to set(MINGWLIBPATH ${MINGWBINPATH}/../lib ${MINGWBINPATH}/../mingw/lib it works for both my 32-bit and 64-bit compiler. While you're at it, you might also add ${MINGWBINPATH}/../x86_64-w64-mingw32/lib and ${MINGWBINPATH}/../i686-w64-mingw32/lib to that list. By way of explanation: The current setting accommodates only the mingw.org directory structure for their 32-bit compiler. (That's the 32-bit compiler that I use.) Adding ${MINGWBINPATH}/../mingw/lib will accommodate the 64-bit cross-compiler provided by mingw64.sf.net. (That's the 64-bit compiler that I use.) Adding ${MINGWBINPATH}/../x86_64-w64-mingw32/lib will accommodate the 64-bit "sezero"[1] compiler (not a cross-compiler) provided by mingw64.sf.net. (That's the 64-bit compiler used by sane people, and Strawberry Perl [2]) Adding ${MINGWBINPATH}/../i686-w64-mingw32/lib will accommodate the 32-bit "sezero"[1] compiler provided by mingw64.sf.net. (That's the 32-bit compiler that's used by Strawberry Perl.) [1] "sezero" is just the nick of the guy who builds those compiler versions. [2] No, I'm not trying to insinuate that Strawberry Perl is insane. I've made some progress on modifying the name of the C compiler, too. I've found that instead of copying 'x86_64-w64-mingw32-gcc.exe' to 'gcc.exe' I can just use the -DCMAKE_C_COMPILER option to specify the correct name. For some strange reason that I haven't yet fathomed, specifying the name of the C++ compiler (which is 'x86_64-w64-mingw32-g++.exe' ) using -DCMAKE_CXX_COMPILER fails to work. I get: -- The CXX compiler identification is unknown -- Check for working CXX compiler: g++.exe ... groan ... but then, I don't really give a rat's arse about C++ :-) (I will, however, out of curiosity, try to find out what's going on there.) Haven't yet worked out how I'm supposed to tell the process that 'ar.exe' is really named 'x86_64-w64-mingw32-ar.exe' . Anyone know ? Cheers, Rob |