Hello I am new to cmake,
I have two question´s concerning cross compiling with gnu compilers
1) First Question: Can anyone explain me, why a toolchain file is called twice when cross compiling? I use the current cmake version 3.2.2.
I use this toolchain file as an example...
# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_SYSTEM_NAME Windows)
message(STATUS "cross compiling with mingw32")
# which compilers to use for C and C++
SET(TOOLCHAIN_PATH "c:/MinGW32/bin")
SET(CMAKE_C_COMPILER ${TOOLCHAIN_PATH}/gcc.exe)
SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_PATH}/g++.exe)
SET(CMAKE_RC_COMPILER ${TOOLCHAIN_PATH}/windres.exe)
SET(TOOLCHAIN_PATH "c:/MinGW32/bin")
SET(CMAKE_C_COMPILER ${TOOLCHAIN_PATH}/gcc.exe)
SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_PATH}/g++.exe)
SET(CMAKE_RC_COMPILER ${TOOLCHAIN_PATH}/windres.exe)
# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH /MinGW32/bin)
SET(CMAKE_FIND_ROOT_PATH /MinGW32/bin)
# adjust the default behavior 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)
# 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)
.. but the same happens whit other toolchain files => as an example on cross compiling for GNU ARM.
2) Second Question:
Is there a common way to select a specific Compiler and Compiler Version?
thx for the help
regards,
mathias
-- Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake