I have a similar query and close it as I thought it worked. Actually I still have problem. So I post in a new thread. My CMake is always building for Visual Studio 2010. I am cross compiling for Raspberry PI and my toolchain file is as follow.
SET(CMAKE_SYSTEM_NAME Linux) # this one is important
SET(CMAKE_SYSTEM_VERSION 1) # this one not so much
SET(CMAKE_C_COMPILER C:/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER C:/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++)
SET(CMAKE_AR C:/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-ar)
SET(CMAKE_LINKER C:/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-ld)
SET(CMAKE_NM C:/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-nm)
SET(CMAKE_OBJCOPY C:/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-objcopy)
SET(CMAKE_OBJDUMP C:/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-objdump)
SET(CMAKE_STRIP C:/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-strip)
SET(CMAKE_RANLIB C:/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-tanlib)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH C:/ThitSan_Backup/RasberryPI/rpi/helloWorld)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
But when I run cmake, it build for Visual Studio 2010 as shown in the attached image.
Both
cmake -D CMAKE_TOOLCHAIN_FILE=../toolchain-rpi.cmake ../
and cmake CMAKE_TOOLCHAIN_FILE=../toolchain-rpi.cmake ../
gave me same results.
My question are
(1) why cmake is trying to build for Visual Studio 2010 in default?
(2)What are the things I need to look at to cross compile for Raspberry PI using arm compiler to avoid such problem?
Thanks