Hi,
I'm working on an embedded project using a Microchip microcontroller. I want to use Cmake to do the configuration so that I can store the project and build settings under change control, as well as have the configuration compatible with development windows machines, and an automated build system on a linux server. Microchip provides a modified gcc suite for their compiler, so I figured I could use a cross-platform toolchain file. The compiler directory is put in the PATH on install, so I just use "pic30-gcc" in said toolchain file. Long story short, using the MinGW MSYS environment, I can get cmake to configure the project and use the MSYS make utility to build it, which works beautifully. I wanted to then try some other generators so I can for example, make Code::Blocks projects. However, when I went to use the MinGW generator, I ran into a problem: C:\Users\dmitri.kourennyi\Documents\Development\testing\mingw>cmake -G "MinGW Makefiles" .. -- The C compiler identification is unknown -- The CXX compiler identification is GNU -- Check for working C compiler: C:/Program Files (x86)/Microchip/mplabc30/v3.30c/bin/pic30-gcc.exe -- Check for working C compiler: C:/Program Files (x86)/Microchip/mplabc30/v3.30c/bin/pic30-gcc.exe -- broken CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE): The C compiler "C:/Program Files (x86)/Microchip/mplabc30/v3.30c/bin/pic30-gcc.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: C:/Users/dmitri.kourennyi/Documents/Development/testing/mingw/CMakeFiles/CMakeTmp Run Build Command:C:/MinGW/bin/mingw32-make.exe "cmTryCompileExec/fast" C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTryCompileExec.dir\build.make CMakeFiles/cmTryCompileExec.dir/build mingw32-make.exe[1]: Entering directory `C:/Users/dmitri.kourennyi/Documents/Development/testing/mingw/CMakeFiles/CMakeTmp' "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_report C:\Users\dmitri.kourennyi\Documents\Development\testing\mingw\CMakeFiles\CMakeTmp\CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj C:\PROGRA~2\MICROC~1\mplabc30\v3.30c\bin\PIC30-~4.EXE -o CMakeFiles\cmTryCompileExec.dir\testCCompiler.c.obj -c C:\Users\dmitri.kourennyi\Documents\Development\testing\mingw\CMakeFiles\CMakeTmp\testCCompiler.c mingw32-make.exe[1]: *** [CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj] Error 255 mingw32-make.exe[1]: Leaving directory `C:/Users/dmitri.kourennyi/Documents/Development/testing/mingw/CMakeFiles/CMakeTmp' mingw32-make.exe: *** [cmTryCompileExec/fast] Error 2 CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:5 (PROJECT) -- Configuring incomplete, errors occurred! After troubleshooting it for a while, including using the --debug-trycompile option, I was able to determine that the following command is the problem: C:\PROGRA~2\MICROC~1\mplabc30\v3.30c\bin\PIC30-~4.EXE Pasting this line into the command prompt does nothing, even though it should say that no input file was specified. In order to confirm this, I edited the CMakeCache.txt file and set CMAKE_C_COMPILER_WORKS:INTERNAL to TRUE, then replaced all instances of C:\PROGRA~2\MICROC~1\mplabc30\v3.30c\bin\PIC30-~4.EXE with "C:/Program Files (x86)/Microchip/mplabc30/v3.30c/bin/pic30-gcc.exe" (quotes included). With this configuration the make procedure works fine. I tried using CMAKE_FORCE_C_COMPILER, which does bypass the compiler check, but the make still fails because the 8.3 path is still used in the Makefiles. To summarize, for whatever reason the compiler refuses to run when invoked using the 8.3 naming conventions. I can work around it by bypassing the compiler check and reconverting the 8.3 path to the fully qualified path manually. Is there any way I can avoid this problem so the cmake generation procedure stays automatic and easy? Or is this a bug in the compiler/MinGW, or other issue altogether? Thanks, -Dmitri Toolchain file (C30.cmake): # this one is important SET(CMAKE_SYSTEM_NAME Generic) #this one not so much SET(CMAKE_SYSTEM_VERSION 1) # specify the cross compiler SET(CMAKE_C_COMPILER pic30-gcc) # where is the target environment SET(CMAKE_FIND_ROOT_PATH "C:/Program Files (x86)/Microchip/mplabc30/v3.30c") # 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) Project file (CMakeLists.txt): SET(CMAKE_TOOLCHAIN_FILE C30.cmake) CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(MicrochipCMakeTest) SET(CMAKE_C_FLAGS "-Wall -Os") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--report-mem") ##### Create cof binary ADD_EXECUTABLE(hikari01.cof main.c)
-- 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