Re: [CMake] Cross compiling in Win32 environment doesn't work

2011-09-19 Thread Benjamin Ruard
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 

[CMake] [Cmake/SWIG/JAVA/WINDOWS] add -Wl,--kill-at flag

2011-08-04 Thread Benjamin Ruard
Hi everybody,
I use CMake to wrap a c++ library in Java with swig. When I use linux OS
it works very well, but when I use windows OS there is a problem.
Indeed, the compilation works fine but the dll has not the correct
method/fonction inside. After several researches on the web I find I
must use the flag -Wl,--kill-at when I create the dll. But I do not
find the equivalent flag on cmake, I try:

CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS
CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS
CMAKE_SHARED_LIBRARY_CXX_FLAGS
CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS
CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG
CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP
CMAKE_SHARED_LIBRARY_LINK_STATIC_CXX_FLAGS
CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_CXX_FLAGS

Does somebody know a solution?

Thanks

Benjamin JEANTY-RUARD

___
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] [Cmake/SWIG/JAVA/WINDOWS] add -Wl,--kill-at flag

2011-08-04 Thread Benjamin Ruard
Thanks for your answer, but

The block:
extern C {
...
}

already exists.

Regards.

Benjamin JEANTY-RUARD

Le jeudi 04 août 2011 à 08:40 -0400, David Cole a écrit :
 Are you sure you don't just need an:
 
 extern C {
 }
 
 block around a function implemented in a C++ file...?
 
 
 On Thu, Aug 4, 2011 at 7:30 AM, Benjamin Ruard ru...@artenum.com wrote:
  Hi everybody,
  I use CMake to wrap a c++ library in Java with swig. When I use linux OS
  it works very well, but when I use windows OS there is a problem.
  Indeed, the compilation works fine but the dll has not the correct
  method/fonction inside. After several researches on the web I find I
  must use the flag -Wl,--kill-at when I create the dll. But I do not
  find the equivalent flag on cmake, I try:
 
  CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS
  CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS
  CMAKE_SHARED_LIBRARY_CXX_FLAGS
  CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS
  CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG
  CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP
  CMAKE_SHARED_LIBRARY_LINK_STATIC_CXX_FLAGS
  CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_CXX_FLAGS
 
  Does somebody know a solution?
 
  Thanks
 
  Benjamin JEANTY-RUARD
 
  ___
  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
 


___
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