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\output>cmake -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 (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

--


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

novero GmbH
meesmannstr.103 | 44807 Bochum | germany


novero gmbh | parsevalstr.
7 a | 40468 düsseldorf | germany | amtsgericht düsseldorf | hrb 58283 | umsatzsteueridentifikationsnummer: de 814973142 | geschäftsführender 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 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