Re: [CMake] Cross compiling in Win32 environment doesn't work
Hi Alex, sorry for sending mails in HTML format (hopefully the mail client is now configured correctly). You'll find my answers to your comments below. On 20.09.11 05:29, Alexander Neundorf wrote: Hi, can you please adjust your mail client so it doesn't send HTML mails ? On Monday, September 19, 2011 04:57:32 PM Martin Kupke wrote: That's a hint, I changed my toolchain file toolchain_ppc.cmake to the following: INCLUDE(CMakeForceCompiler) set(CMAKE_SYSTEM_NAME Discovery) if(CMAKE_CROSSCOMPILING) message(Cross Compiling) endif(CMAKE_CROSSCOMPILING) # which compilers to use for C and C++ set(CMAKE_C_COMPILER C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe) set(CMAKE_FORCE_C_COMPILER C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe) set(CMAKE_C_FLAGS -tPPCVLEEN:simple) Then I created a folder with the name Platform containing a file with CMAKE_SYSTEM_NAME which is Discovery - at this point I had already problems, because CMake doesn't use as described the filename with .cmake extension. The filename in the Platform folder has to have the name from CMAKE_SYSTEM_NAME without the extension .cmake (even the documentation says something different). I checked this by adding the output of a message(SYSTEM_NAME=Discovery). The filename must be Discovery.cmake in your case. Did you say this didn't work ? This file must be either in the cmake Modules/Platfom/ directory, or in a subdirectory Platform/ of a directory which is in CMAKE_MODULE_PATH. Yes, I created the folder Platform in my CMAKE_MODULE_PATH and within this folder the file Discovery.cmake. This doesn't work! I checked it using the message tag to output a string on the console. After renaming the Discovery.cmake to only basename Discovery without the extension .cmake, the file was included. So, the extension .cmake isn't correct...even it is described in the documentation. The output of the CMake tool, if using the CMAKE_SYSTEM_NAME set to Discovery: ### snip ### D:\novero\Discovery\impl\target\CarIF_Appl\outputcmake -G NMake Makefiles -D CMAKE_TOOLCHAIN_FILE=..\toolchain_ppc.cmake .. Cross Compiling -- The C compiler identification is unknown -- Check for working C compiler: c:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe System is unknown to cmake, create: Platform/Discovery to use this system, please send your config file to cm...@www.cmake.org so it can be added to cmake -- Check for working C compiler: c:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe --works -- Detecting C compiler ABI info System is unknown to cmake, create: Platform/Discovery to use this system, please send your config file to cm...@www.cmake.org so it can be added to cmake -- Detecting C compiler ABI info - done C compiler: c:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe C flags: -tPPCVLEEN:simple Mein CMakeLists.txt File -- Configuring done -- Generating done -- Build files have been written to: D:/novero/Discovery/impl/target/CarIF_Appl/output ### snap ### It seems to work, even there are some hints that CMake doesn't know the system Discovery. I fixed the problem by using the CMAKE_SYSTEM_NAME set to Generic. With Generic I need a configuration file in the Platform folder named to Generic-dcc with the compile flags. The name in the Platform folder again is used without the extension .cmake! Generic needs to be added with -dcc because of the Base name of the dcc.exe compiler. This now works and creates the Makefile in the output folder as wanted, without any errors / warnings ... The Platform/Discovery file contains the lines: message(SYSTEM_NAME=Discovery) set(CMAKE_FORCE_C_COMPILER C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe) set(CMAKE_C_COMPILER C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe) set(CMAKE_C_FLAGS -tPPCVLEEN:simple) set(CMAKE_FORCE_C_FLAGS -tPPCVLEEN:simple) set(CMAKE_FORCE_CXX_COMPILER C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe) set(CMAKE_CXX_COMPILER C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe) set(CMAKE_CXX_FLAGS -tPPCVLEEN:simple) set(CMAKE_MAKE_PROGRAM D:/novero/Discovery/impl/win32/nmake/nmake.exe) That last line should not be necessary. I thought this would help to point to the nmake tool in the Makefile, in case it is not in the search path of the system. Then I call from the command line the CMake tool with the parameters: D:\novero\Discovery\impl\target\CarIF_Appl\outputcmake -G NMake Makefiles -D CMAKE_TOOLCHAIN_FILE=..\toolchain_ppc.cmake .. The following output will be produced: * snip output * Cross Compiling -- The C compiler identification is unknown -- The CXX compiler identification is unknown SYSTEM_NAME=Discovery SYSTEM_NAME=Discovery -- Check for working C compiler: C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe System is unknown to cmake, create: Platform/Discovery to use this system, please send your config file to cmake@www .cmake.org
Re: [CMake] Cross compiling in Win32 environment doesn't work
2011/9/19 Martin Kupke martin.ku...@novero.com: I'm using CMake in version 2.8.5 and just want to cross compile with a decicated Compiler / Linker set on my Windows machine. Of course I've read the FAQ and the Tutorial, afterwards I started trying to use CMake on a DOS (cmd.exe) command line interface with CMakeLists.txt and a toolchain file. After all tests failed to get CMake work in the Win32 environment, I tried it in my private Linux (Debian Squeeze) and the same procedure is successful. In Linux environment it works as described, in Win32 not. My PC has installed Windows XP including SP3. CMake version 2.8.5 is installed. My development path contains a CMakeLists.txt and a toolchain_ppc.cmake file, because I want to compile on my WinXP code for an embedded hardware using a PPC processor. The toolchain_ppc.cmake file contains the following settings: set (CMAKE_GENERATOR NMake Makefiles) I'm not sure whether if CMAKE_GENERATOR can be set in the toolchain file? [...] D:\novero\Discovery\impl\target\CarIF_Appl\outputcmake -D CMAKE_TOOLCHAIN_FILE=..\toolchain_ppc.cmake .. did you try to add '-G NMake Makefiles' to your command line? [...] I just want to use a standard Assembler, C Compiler and Linker. I don't need CXX (C++) in my build environment and even I don't need (want) any Visual Studio in my Cross Compilation. The generator for CMake shall be NMake Makefiles so that the generated Makefile can be used with NMake. Hopefully you can help me out of this. ___ 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 Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org ___ 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
Re: [CMake] Cross compiling in Win32 environment doesn't work
If adding the parameter -G "NMake Makefiles" to my command line, then the output is different...but still errors: * snip output * Cross Compiling -- The C compiler identification is unknown -- The CXX compiler identification is unknown -- Check for working C compiler: C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe -- Check for working C compiler: C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe -- broken CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCComp iler.cmake:52 (MESSAGE): The C compiler "C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: D:/novero/Discovery/impl/target/CarIF_Appl/output/CMakeFiles/CMak eTmp Run Build Command:nmake /NOLOGO "cmTryCompileExec\fast" nmake -f CMakeFiles\cmTryCompileExec.dir\build.make /nologo -L CMakeFiles\cmTryCompileExec.dir\build "C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_progress_report D:\novero\Discovery\impl\target\CarIF_Appl\output\CMakeFiles\CMakeTmp\CMakeFil es 1 Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj C:\WindRiver\diab\5.9.0.0\WIN32\bin\dcc.exe -o CMakeFiles\cmTryCompileExec.dir\testCCompiler.c.obj -c D:\novero\Discovery\impl\target\CarIF_Appl\output\CMakeFiles\CMakeTmp\testCCom piler.c Target Unknown. Use the -t option or set a default target with dctrl -t NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x1' Stop. NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x2' Stop. * snap output * As you can see above, now the CMAKE_C_FLAGS are not recognized. set(CMAKE_C_FLAGS "-tPPCVLEEN:simple") On 19.09.11 15:24, Eric Noulard wrote: 2011/9/19 Martin Kupke martin.ku...@novero.com: I'm using CMake in version 2.8.5 and just want to cross compile with a decicated Compiler / Linker set on my Windows machine. Of course I've read the FAQ and the Tutorial, afterwards I started trying to use CMake on a DOS (cmd.exe) command line interface with CMakeLists.txt and a toolchain file. After all tests failed to get CMake work in the Win32 environment, I tried it in my private Linux (Debian Squeeze) and the same procedure is successful. In Linux environment it works as described, in Win32 not. My PC has installed Windows XP including SP3. CMake version 2.8.5 is installed. My development path contains a CMakeLists.txt and a toolchain_ppc.cmake file, because I want to compile on my WinXP code for an embedded hardware using a PPC processor. The toolchain_ppc.cmake file contains the following settings: set (CMAKE_GENERATOR "NMake Makefiles") I'm not sure whether if CMAKE_GENERATOR can be set in the toolchain file? [...] D:\novero\Discovery\impl\target\CarIF_Appl\outputcmake -D CMAKE_TOOLCHAIN_FILE="..\toolchain_ppc.cmake" .. did you try to add '-G "NMake Makefiles"' to your command line? [...] I just want to use a standard Assembler, C Compiler and Linker. I don't need CXX (C++) in my build environment and even I don't need (want) any Visual Studio in my Cross Compilation. The generator for CMake shall be "NMake Makefiles" so that the generated Makefile can be used with "NMake". Hopefully you can help me out of this. ___ 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 -- martin kupke can diagnostics engineer | senior software developer m: +49.151.5511.3632 | e: martin.ku...@novero.com skype: martin.kupke_novero | w: www.novero.com meesmannstr.103 | 44807 Bochum | germany novero gmbh | parsevalstr. 7 a | 40468 dsseldorf | germany | amtsgericht dsseldorf | hrb 58283 | umsatzsteueridentifikationsnummer: de 814973142 | geschftsfhrender gesellschafter: razvan olosu ___ 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
Re: [CMake] Cross compiling in Win32 environment doesn't work
My problem (the error) already occurs in the toolchain file, this means before the CMakeLists.txt is read. So far it is total independent of the entries in the CMakeLists.txt! I have added the line: message ("Mein CMakeLists.txt File") in top of my CMakeLists.txt and would assume that there is an output on the console with the string, but it isn't. The output is stopped while parsing the toolchain file and determining the compiler. On 19.09.11 15:26, Benjamin Ruard wrote: You can use the following commands to know what are compilers used in the CMakeLists.txt: message("C compiler: " ${CMAKE_C_COMPILER}) message("C++ compiler: " ${CMAKE_CXX_COMPILER}) Moreover, you can set them: set(CMAKE_CXX_COMPILER ...) regards Benjamin JEANTY-RUARD Le lundi 19 septembre 2011 à 14:44 +0200, Martin Kupke a écrit : I'm using CMake in version 2.8.5 and just want to cross compile with a decicated Compiler / Linker set on my Windows machine. Of course I've read the FAQ and the Tutorial, afterwards I started trying to use CMake on a DOS (cmd.exe) command line interface with CMakeLists.txt and a toolchain file. After all tests failed to get CMake work in the Win32 environment, I tried it in my private Linux (Debian Squeeze) and the same procedure is successful. In Linux environment it works as described, in Win32 not. My PC has installed Windows XP including SP3. CMake version 2.8.5 is installed. My development path contains a CMakeLists.txt and a toolchain_ppc.cmake file, because I want to compile on my WinXP code for an embedded hardware using a PPC processor. The toolchain_ppc.cmake file contains the following settings: set (CMAKE_GENERATOR "NMake Makefiles") set (CMAKE_SYSTEM_NAME "Generic") set (CMAKE_C_COMPILER "dcc.exe") set (CMAKE_SYSTEM_PROCESSOR "ppc") if(CMAKE_CROSSCOMPILING) message("Cross Compiling") endif(CMAKE_CROSSCOMPILING) set(CMAKE_C_COMPILER "C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe") set(CMAKE_C_FLAGS "-tPPCVLEEN:simple") In my build environment I created an empty folder output and in the command line interface (console / cmd.exe) I'm calling the cmake tool: D:\novero\Discovery\impl\target\CarIF_Appl\outputcmake -D CMAKE_TOOLCHAIN_FILE="..\toolchain_ppc.cmake" .. The output of the cmake tool always is: -- Building for: Visual Studio 10 Cross Compiling As you can see my message "Cross Compiling" is shown, this introduces that cmake is using the "CMAKE_CROSSCOMPILING" flag. But why the hell is there always the output "-- Building for: Visual Studio 10"? I don't wan't to use anything from / for Visual Studio 10. The CMakeOutput.log contains the following lines: The target system is: Generic - - ppc The host system is: Windows - 5.1 - x86 Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. Compiler: C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe Build flags: -tPPCVLEEN:simple Id flags: The output was: 0 Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out" Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. Compiler: C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe Build flags: -tPPCVLEEN:simple Id flags: -c The output was: 0 Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.o" Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. Compiler: C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe Build flags: -tPPCVLEEN:simple Id flags: The output was: 0 Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. Compiler: C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe Build flags: -tPPCVLEEN:simple Id flags: -c The output was: 0 Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.o" Determining if the C compiler works passed with the following output: Change Dir: D:/novero/Discovery/impl/target/CarIF_Appl/output/CMakeFiles/CMakeTmp Run Build Command:C:\PROGRA~1\MICROS~2.0\Common7\IDE\devenv.com CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec Microsoft (R) Visual Studio Version 10.0.30319.1. Copyright (C) Microsoft Corp. All rights reserved. 1-- Build started: Project: cmTryCompileExec, Configuration: Debug Win32 -- 1 testCCompiler.c 1C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(D:\novero\Discovery\impl\target\CarIF_Appl\output\CMakeFiles\CMakeTmp\Debug\cmTryCompileExec) does not match the Linker's OutputFile property value (D:\novero\Discovery\impl\target\CarIF_Appl\output\CMakeFiles\CMakeTmp\Debug\cmTryCompileExec.exe). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName)
Re: [CMake] Cross compiling in Win32 environment doesn't work
2011/9/19 Martin Kupke martin.ku...@novero.com My problem (the error) already occurs in the toolchain file, this means before the CMakeLists.txt is read. So far it is total independent of the entries in the CMakeLists.txt! I have added the line: message (Mein CMakeLists.txt File) in top of my CMakeLists.txt and would assume that there is an output on the console with the string, but it isn't. The output is stopped while parsing the toolchain file and determining the compiler. That's what I was about to say. Read http://www.vtk.org/Wiki/CMake_Cross_Compiling carefully you'll see that you may have to write a Platform/${CMAKE_SYSTEM_NAME}-compiler.cmake file in order to inform CMake about your particular compiler compilation FLAGS. Doing it in CMakeLists.txt may already be too late. Nevertheless it puzzles me that it works on Linux and not on Windows... I'm no expert concerning Cross-compiling with CMake so I let others take over this discussion. -- Erk Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org ___ 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
Re: [CMake] Cross compiling in Win32 environment doesn't work
You can use the following commands to know what are compilers used in the CMakeLists.txt: message(C compiler: ${CMAKE_C_COMPILER}) message(C++ compiler: ${CMAKE_CXX_COMPILER}) Moreover, you can set them: set(CMAKE_CXX_COMPILER ...) regards Benjamin JEANTY-RUARD Le lundi 19 septembre 2011 à 14:44 +0200, Martin Kupke a écrit : I'm using CMake in version 2.8.5 and just want to cross compile with a decicated Compiler / Linker set on my Windows machine. Of course I've read the FAQ and the Tutorial, afterwards I started trying to use CMake on a DOS (cmd.exe) command line interface with CMakeLists.txt and a toolchain file. After all tests failed to get CMake work in the Win32 environment, I tried it in my private Linux (Debian Squeeze) and the same procedure is successful. In Linux environment it works as described, in Win32 not. My PC has installed Windows XP including SP3. CMake version 2.8.5 is installed. My development path contains a CMakeLists.txt and a toolchain_ppc.cmake file, because I want to compile on my WinXP code for an embedded hardware using a PPC processor. The toolchain_ppc.cmake file contains the following settings: set (CMAKE_GENERATOR NMake Makefiles) set (CMAKE_SYSTEM_NAME Generic) set (CMAKE_C_COMPILER dcc.exe) set (CMAKE_SYSTEM_PROCESSOR ppc) if(CMAKE_CROSSCOMPILING) message(Cross Compiling) endif(CMAKE_CROSSCOMPILING) set(CMAKE_C_COMPILER C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe) set(CMAKE_C_FLAGS -tPPCVLEEN:simple) In my build environment I created an empty folder output and in the command line interface (console / cmd.exe) I'm calling the cmake tool: D:\novero\Discovery\impl\target\CarIF_Appl\outputcmake -D CMAKE_TOOLCHAIN_FILE=..\toolchain_ppc.cmake .. The output of the cmake tool always is: -- Building for: Visual Studio 10 Cross Compiling As you can see my message Cross Compiling is shown, this introduces that cmake is using the CMAKE_CROSSCOMPILING flag. But why the hell is there always the output -- Building for: Visual Studio 10? I don't wan't to use anything from / for Visual Studio 10. The CMakeOutput.log contains the following lines: The target system is: Generic - - ppc The host system is: Windows - 5.1 - x86 Compiling the C compiler identification source file CMakeCCompilerId.c succeeded. Compiler: C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe Build flags: -tPPCVLEEN:simple Id flags: The output was: 0 Compilation of the C compiler identification source CMakeCCompilerId.c produced a.out Compiling the C compiler identification source file CMakeCCompilerId.c succeeded. Compiler: C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe Build flags: -tPPCVLEEN:simple Id flags: -c The output was: 0 Compilation of the C compiler identification source CMakeCCompilerId.c produced CMakeCCompilerId.o Compiling the CXX compiler identification source file CMakeCXXCompilerId.cpp succeeded. Compiler: C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe Build flags: -tPPCVLEEN:simple Id flags: The output was: 0 Compilation of the CXX compiler identification source CMakeCXXCompilerId.cpp produced a.out Compiling the CXX compiler identification source file CMakeCXXCompilerId.cpp succeeded. Compiler: C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe Build flags: -tPPCVLEEN:simple Id flags: -c The output was: 0 Compilation of the CXX compiler identification source CMakeCXXCompilerId.cpp produced CMakeCXXCompilerId.o Determining if the C compiler works passed with the following output: Change Dir: D:/novero/Discovery/impl/target/CarIF_Appl/output/CMakeFiles/CMakeTmp Run Build Command:C:\PROGRA~1\MICROS~2.0\Common7\IDE\devenv.com CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec Microsoft (R) Visual Studio Version 10.0.30319.1. Copyright (C) Microsoft Corp. All rights reserved. 1-- Build started: Project: cmTryCompileExec, Configuration: Debug Win32 -- 1 testCCompiler.c 1C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(D:\novero\Discovery\impl\target\CarIF_Appl\output\CMakeFiles\CMakeTmp\Debug\cmTryCompileExec) does not match the Linker's OutputFile property value (D:\novero\Discovery\impl\target\CarIF_Appl\output\CMakeFiles\CMakeTmp\Debug\cmTryCompileExec.exe). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile). 1 cmTryCompileExec.vcxproj - D:\novero\Discovery\impl\target\CarIF_Appl\output\CMakeFiles\CMakeTmp\Debug\cmTryCompileExec == Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped == Detecting C compiler ABI info compiled with the following output: Change Dir: D:/novero/Discovery/impl/target/CarIF_Appl/output/CMakeFiles/CMakeTmp Run Build
Re: [CMake] Cross compiling in Win32 environment doesn't work
That's a hint, I changed my toolchain file "toolchain_ppc.cmake" to the following: INCLUDE(CMakeForceCompiler) set(CMAKE_SYSTEM_NAME "Discovery") if(CMAKE_CROSSCOMPILING) message("Cross Compiling") endif(CMAKE_CROSSCOMPILING) # which compilers to use for C and C++ set(CMAKE_C_COMPILER "C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe") set(CMAKE_FORCE_C_COMPILER "C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe") set(CMAKE_C_FLAGS "-tPPCVLEEN:simple") Then I created a folder with the name Platform containing a file with CMAKE_SYSTEM_NAME which is Discovery - at this point I had already problems, because CMake doesn't use as described the filename with .cmake extension. The filename in the Platform folder has to have the name from CMAKE_SYSTEM_NAME without the extension .cmake (even the documentation says something different). I checked this by adding the output of a message("SYSTEM_NAME=Discovery"). The Platform/Discovery file contains the lines: message("SYSTEM_NAME=Discovery") set(CMAKE_FORCE_C_COMPILER "C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe") set(CMAKE_C_COMPILER "C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe") set(CMAKE_C_FLAGS "-tPPCVLEEN:simple") set(CMAKE_FORCE_C_FLAGS "-tPPCVLEEN:simple") set(CMAKE_FORCE_CXX_COMPILER "C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe") set(CMAKE_CXX_COMPILER "C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe") set(CMAKE_CXX_FLAGS "-tPPCVLEEN:simple") set(CMAKE_MAKE_PROGRAM "D:/novero/Discovery/impl/win32/nmake/nmake.exe") Then I call from the command line the CMake tool with the parameters: D:\novero\Discovery\impl\target\CarIF_Appl\outputcmake -G "NMake Makefiles" -D CMAKE_TOOLCHAIN_FILE="..\toolchain_ppc.cmake" .. The following output will be produced: * snip output * Cross Compiling -- The C compiler identification is unknown -- The CXX compiler identification is unknown SYSTEM_NAME=Discovery SYSTEM_NAME=Discovery -- Check for working C compiler: C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe System is unknown to cmake, create: Platform/Discovery to use this system, please send your config file to cmake@www .cmake.org so it can be added to cmake -- Check for working C compiler: C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe -- broken CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCComp iler.cmake:52 (MESSAGE): The C compiler "C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: D:/novero/Discovery/impl/target/CarIF_Appl/output/CMakeFiles/CMak eTmp Run Build Command:nmake /NOLOGO "cmTryCompileExec\fast" nmake -f CMakeFiles\cmTryCompileExec.dir\build.make /nologo -L CMakeFiles\cmTryCompileExec.dir\build "C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_progress_report D:\novero\Discovery\impl\target\CarIF_Appl\output\CMakeFiles\CMakeTmp\CMakeFil es 1 Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj C:\WindRiver\diab\5.9.0.0\WIN32\bin\dcc.exe -o CMakeFiles\cmTryCompileExec.dir\testCCompiler.c.obj -c D:\novero\Discovery\impl\target\CarIF_Appl\output\CMakeFiles\CMakeTmp\testCCom piler.c Target Unknown. Use the -t option or set a default target with dctrl -t NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x1' Stop. NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x2' Stop. CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:2 (project) -- Configuring incomplete, errors occurred! You have changed variables that require your cache to be deleted. Configure will be re-run and you may have to reset some variables. The following variables have changed: CMAKE_CXX_COMPILER= cl -- Generating done -- Build files have been written to: D:/novero/Discovery/impl/target/CarIF_Appl/ output * snap output * 1.) with the output SYSTEM_NAME=Discovery I can see that the platform file is used 2.) the compilation doesn't complete, because the CMAKE_C_FLAGS are still not used 3.) why do I have to have a CXX (C++) compiler, even if I don't need it in my embedded solution 4.) is there any reason why CMake needs to know my system? I want just to compile some files... (wondering) On 19.09.11 15:46, Eric Noulard wrote: 2011/9/19 Martin Kupke martin.ku...@novero.com My problem
Re: [CMake] Cross compiling in Win32 environment doesn't work
Hi, can you please adjust your mail client so it doesn't send HTML mails ? On Monday, September 19, 2011 04:57:32 PM Martin Kupke wrote: That's a hint, I changed my toolchain file toolchain_ppc.cmake to the following: INCLUDE(CMakeForceCompiler) set(CMAKE_SYSTEM_NAME Discovery) if(CMAKE_CROSSCOMPILING) message(Cross Compiling) endif(CMAKE_CROSSCOMPILING) # which compilers to use for C and C++ set(CMAKE_C_COMPILER C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe) set(CMAKE_FORCE_C_COMPILER C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe) set(CMAKE_C_FLAGS -tPPCVLEEN:simple) Then I created a folder with the name Platform containing a file with CMAKE_SYSTEM_NAME which is Discovery - at this point I had already problems, because CMake doesn't use as described the filename with .cmake extension. The filename in the Platform folder has to have the name from CMAKE_SYSTEM_NAME without the extension .cmake (even the documentation says something different). I checked this by adding the output of a message(SYSTEM_NAME=Discovery). The filename must be Discovery.cmake in your case. Did you say this didn't work ? This file must be either in the cmake Modules/Platfom/ directory, or in a subdirectory Platform/ of a directory which is in CMAKE_MODULE_PATH. The Platform/Discovery file contains the lines: message(SYSTEM_NAME=Discovery) set(CMAKE_FORCE_C_COMPILER C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe) set(CMAKE_C_COMPILER C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe) set(CMAKE_C_FLAGS -tPPCVLEEN:simple) set(CMAKE_FORCE_C_FLAGS -tPPCVLEEN:simple) set(CMAKE_FORCE_CXX_COMPILER C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe) set(CMAKE_CXX_COMPILER C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe) set(CMAKE_CXX_FLAGS -tPPCVLEEN:simple) set(CMAKE_MAKE_PROGRAM D:/novero/Discovery/impl/win32/nmake/nmake.exe) That last line should not be necessary. Then I call from the command line the CMake tool with the parameters: D:\novero\Discovery\impl\target\CarIF_Appl\outputcmake -G NMake Makefiles -D CMAKE_TOOLCHAIN_FILE=..\toolchain_ppc.cmake .. The following output will be produced: * snip output * Cross Compiling -- The C compiler identification is unknown -- The CXX compiler identification is unknown SYSTEM_NAME=Discovery SYSTEM_NAME=Discovery -- Check for working C compiler: C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe System is unknown to cmake, create: Platform/Discovery to use this system, please send your config file to cmake@www .cmake.org so it can be added to cmake -- Check for working C compiler: C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe -- broken CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCComp iler.cmake:52 (MESSAGE): The C compiler C:/WindRiver/diab/5.9.0.0/WIN32/bin/dcc.exe is not able to compile a simple test program. It fails with the following output: Change Dir: D:/novero/Discovery/impl/target/CarIF_Appl/output/CMakeFiles/CMak eTmp Run Build Command:nmake /NOLOGO cmTryCompileExec\fast nmake -f CMakeFiles\cmTryCompileExec.dir\build.make /nologo -L CMakeFiles\cmTryCompileExec.dir\build C:\Program Files\CMake 2.8\bin\cmake.exe -E cmake_progress_report D:\novero\Discovery\impl\target\CarIF_Appl\output\CMakeFiles\CMakeTmp\CMak eFil es 1 Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj C:\WindRiver\diab\5.9.0.0\WIN32\bin\dcc.exe -o CMakeFiles\cmTryCompileExec.dir\testCCompiler.c.obj -c D:\novero\Discovery\impl\target\CarIF_Appl\output\CMakeFiles\CMakeTmp\test CCom piler.c Target Unknown. Use the -t option or set a default target with dctrl -t NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x1' Stop. NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x2' Stop. CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:2 (project) -- Configuring incomplete, errors occurred! You have changed variables that require your cache to be deleted. Configure will be re-run and you may have to reset some variables. The following variables have changed: CMAKE_CXX_COMPILER= cl -- Generating done -- Build files have been written to: D:/novero/Discovery/impl/target/CarIF_Appl/ output * snap output * 1.) with the output SYSTEM_NAME=Discovery I can see that the platform file is used 2.) the compilation doesn't complete, because the CMAKE_C_FLAGS are still not used They are initialized later on. There is a set of variables which are used for initialization, I think it's name is CMAKE_C_FLAGS_INIT . 3.) why do I have to have a CXX (C++) compiler, even if I don't need it in my embedded solution By default cmake enables C and C++. If you put a project(MyProject