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\output>cmake -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 [email protected] 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 [email protected] 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\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\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 .
That was the real needed information which was never given, not in the FAQ...not in the Tutorial... I was studying the file C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\CMakeCInformation.cmake. There I found the base initialization of the variables and could solve my problem.
Your information above would have saved me a lot of hours... ;-)
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 C)
into your toplevel CMakeLists.txt, only the C language will be enabled, not
C++.
That is even a good information and I tested it -> fine!
4.) is there any reason why CMake
needs to know my system? I want just to compile some files... (wondering)
Yes. It needs this information to be able to know e.g. search locations for
the find_xxx() calls, for file prefixes and suffixes, for knowing the compiler
flags for this compiler on this OS
Specially in embedded environment with different possible OS, I think CMake can't know everything. So the best way would be to give the developer a way to configure all by it's own. From my point of view (I'm still beginner with CMake) this is possible, you should even know how to do.

There is still one question open (not really project relevant to me, but interesting): The default setting uses the C compiler always with the parameters -o [output file] -c [source file] I think for most of the C compilers this matches, but what if they use different parameters for output and source? Surely there will be a way to modify that, but I didn't found a note where / how to configure it.

Alex
Alex, many thanks for your reply with the many useful information.

Best regards,
Martin...

_______________________________________________
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