2012/3/27 Jean-Philippe Doyon <[email protected]>: > Dear all, > > I use mingw to port my code from mac to windows. For that, I > have to indicate the compiler used by cmake to that of mingw. > That is set CMAKE_CXX_COMPILER to "i386-mingw32-g++" (which compiles a > binary for windows). You can see the command and the error below. > > cmake -DCMAKE_INSTALL_PREFIX=~/local/install/bpp/windows - > CMAKE_CXX_COMPILER=/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-g++ > loading initial cache file MAKE_CXX_COMPILER=/usr/local/i386- > mingw32-4.3.0/bin/i386-mingw32-g++ > CMake Error: Error processing file:MAKE_CXX_COMPILER=/usr/local/i386- > mingw32-4.3.0/bin/i386-mingw32-g++ > -- Configuring incomplete, errors occurred! > > Could you help me please.
When doing this kind of "cross-compiling" it's better to use a toolchain. Here's the one I use for mingw32/64 on Linux you shall adapt it for MacOS and read this: http://www.cmake.org/Wiki/CMake_Cross_Compiling > > Best > JP > > -- > > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake -- Erk Le gouvernement représentatif n'est pas la démocratie -- http://www.le-message.org
# the name of the target operating system SET(CMAKE_SYSTEM_NAME Windows) # Choose an appropriate compiler prefix # for classical mingw32 # see http://www.mingw.org/ #set(COMPILER_PREFIX "i586-mingw32msvc") # for 32 or 64 bits mingw-w64 # see http://mingw-w64.sourceforge.net/ set(COMPILER_PREFIX "i686-w64-mingw32") #set(COMPILER_PREFIX "x86_64-w64-mingw32" # which compilers to use for C and C++ find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres) #SET(CMAKE_RC_COMPILER ${COMPILER_PREFIX}-windres) find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc) #SET(CMAKE_C_COMPILER ${COMPILER_PREFIX}-gcc) find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++) #SET(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}-g++) # here is the target environment located SET(USER_ROOT_PATH /home/erk/erk-win32-dev) SET(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX} ${USER_ROOT_PATH}) # 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)
-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
