Hi Eric,

On Thursday 5. July 2012 10.22.17, Eric Noulard wrote:
> Which ranlib/ar was discovered by CMake?
/usr/bin/ar and /usr/bin/ranlib. I need it to discover the ones with the mingw 
prefix.

> You did not give us the exact command line you use with the output
> given by the cmake run.
The command I use for cmake is simply cmake -DCMAKE_TOOLCHAIN_FILE=<file> 
<sourcepath>. For better understanding what I do wrong, I attach both the now 
working toolchain file I have, and the non-working one.

With the non-working one I get the following grep result afterwards:

$ grep RANLIB **/*
CMakeCache.txt:CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib
CMakeCache.txt://ADVANCED property for variable: CMAKE_RANLIB
CMakeCache.txt:CMAKE_RANLIB-ADVANCED:INTERNAL=1
CMakeFiles/CMakeCCompiler.cmake:SET(CMAKE_RANLIB "/usr/bin/ranlib")
CMakeFiles/CMakeCXXCompiler.cmake:SET(CMAKE_RANLIB "/usr/bin/ranlib")
CMakeFiles/CMakeFortranCompiler.cmake:SET(CMAKE_RANLIB "/usr/bin/ranlib")

With the now working one I get the following result:

$ grep RANLIB **/*                                                              
     
CMakeCache.txt:CMAKE_RANLIB:FILEPATH=/usr/bin/i486-mingw32-ranlib
CMakeCache.txt://ADVANCED property for variable: CMAKE_RANLIB
CMakeCache.txt:CMAKE_RANLIB-ADVANCED:INTERNAL=1
CMakeFiles/CMakeCCompiler.cmake:SET(CMAKE_RANLIB "/usr/bin/i486-mingw32-
ranlib")
CMakeFiles/CMakeCXXCompiler.cmake:SET(CMAKE_RANLIB "/usr/bin/i486-mingw32-
ranlib")
CMakeFiles/CMakeFortranCompiler.cmake:SET(CMAKE_RANLIB "/usr/bin/i486-mingw32-
ranlib")

> I can ensure you that on my box the provided toolchain works and
> discover a coherent set of mingw compiler and tools (include ar/ranlib)
> there must be something specific in your case.
OK, perhaps I use different cmake version? I have 2.8.8 installed.

$ uname -a
Linux PCBE13951 3.4.3-1-CHAKRA #1 SMP PREEMPT Mon Jun 18 17:39:58 UTC 2012 
x86_64 GNU/Linux

Best Regards,
Yngve
# 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 "i486-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++)
find_program(CMAKE_Fortran_COMPILER NAMES ${COMPILER_PREFIX}-gfortran)


# here is the target environment located
SET(USER_ROOT_PATH $ENV{HOME}/win32-dev/)
message("UHOME: ${USER_ROOT_PATH}")
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)

# An example of how the cross compiler for mingw could look like
# Assuming you are ona Unix platform and want to build for Windows.
# You need to modify this with your own paths/binary names...

# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)

# which compilers to use
SET(CMAKE_C_COMPILER i486-mingw32-gcc)
SET(CMAKE_CXX_COMPILER i486-mingw32-g++)
SET(CMAKE_Fortran_COMPILER i486-mingw32-gfortran)
SET(CMAKE_RC_COMPILER i486-mingw32-windres)
SET(CMAKE_LINKER i486-mingw32-ld)

# this prefix is used by cmake to find ar/ranlib
SET(_CMAKE_TOOLCHAIN_PREFIX i486-mingw32-)

# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH  /usr/i486-mingw32)

# 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)

# Finally we set some Mad-X options..
option( MADX_STATIC "Turn on for static linking" ON)
--

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

Reply via email to