[CMake] HowTo 'Getting Started Cross compilation with cmake' needed

Claus Klein claus.klein at arcormail.de
Sat Jan 20 09:40:16 EST 2007


On Saturday 20 January 2007 15:04, Alexander Neundorf wrote:
> Hi,
> 
> Von: Peter Soetens <peter.soetens at fmtc.be>
> 
> ...
> > > I miss some features needed for cross-compiling, linking and
> > > installing to
> > > a stage dir. The PKGCONFIG(package includedir libdir linkflags
> > > cflags),
> > > for example, the --define-variable option can't be used.
> > > pkg-config(1) support that:
> > >
> > > P3linux:/etc/apt # PKG_CONFIG_PATH=/tools/build_i386/root/lib/pkgconfig
> > > pkg-config  --print-errors
> > --define-variable=prefix=/tools/build_i386/root/
> > > --cflags --libs dbus-1 -I/tools/build_i386/root//include/dbus-1.0
> > > -I/tools/build_i386/root//lib/dbus-1.0/include 
> > > -L/tools/build_i386/root//lib -ldbus-1
> > >
> > > P3linux:/etc/apt # pkg-config  --print-errors  --cflags --libs dbus-1
> > > -I/usr/local/include/dbus-1.0 -I/usr/local/lib/dbus-1.0/include 
> > > -L/usr/local/lib -ldbus-1
> > 
> > I agree here as well. PKGCONFIG support in cmake is work in progress
> > though.
> 
> Are you still using the "old" UsePkgconfig.cmake or did you already switch to find_package(PkgConfig), which is much more powerful ?
Yes, it is better

> 
> > > As a last point, it wout be nice if cmake generates  makefiles
> > > according to:
> > http://www.gnu.org/prep/standards/standards.html#Makefile-Conventions
> > >
> > > I think, most people expect this as common standard, or not?
> > 
> > This is a major issue (read:disagreement) on this list. I expected this
> > as well, but the cmake team has their own reasoning.
> 
> Yes, and I don't see why anybody would be interested in the inner details of the makefiles.
> The makefiles as they are currently generated are much superior to the ones generated by the GNU auto toolchain.
> They are portable to different OS and different make's, and contain correct and complete dependencies, progress report, 
> colored output, why should I care whether their contents conform to some GNU standard ? 
> 
> Bye
> Alex
> 

The commen targets should always supported.

I agree partly about the makevariables like CC, CFLAGS,... , 
but I was confuesed why the generated makefiles uses sometime '$(CXX_FLAGS)' :

claus at P3linux:~/src/CMake/Tests/Tutorial/Step3/build> grep c++ CMakeFiles/Tutorial.dir/build.make
        /usr/bin/c++   $(CXX_FLAGS) -o CMakeFiles/Tutorial.dir/tutorial.o -c /home/claus/src/CMake/Tests/Tutorial/Step3/tutorial.cxx
        /usr/bin/c++  $(CXX_FLAGS) -E /home/claus/src/CMake/Tests/Tutorial/Step3/tutorial.cxx > CMakeFiles/Tutorial.dir/tutorial.i
        /usr/bin/c++  $(CXX_FLAGS) -S /home/claus/src/CMake/Tests/Tutorial/Step3/tutorial.cxx -o CMakeFiles/Tutorial.dir/tutorial.s
        /usr/bin/c++      -fPIC $(Tutorial_OBJECTS) $(Tutorial_EXTERNAL_OBJECTS)  -o Tutorial -rdynamic -L/home/claus/src/CMake/Tests/Tutorial/Step3/build/MathFunctions -Wl,-Bstatic -lMathFunctions -Wl,-Bdynamic -Wl,-rpath,/home/claus/src/CMake/Tests/Tutorial/Step3/build/MathFunctions
        /usr/bin/c++      -fPIC $(Tutorial_OBJECTS) $(Tutorial_EXTERNAL_OBJECTS)  -o CMakeFiles/CMakeRelink.dir/Tutorial -rdynamic -L/home/claus/src/CMake/Tests/Tutorial/Step3/build/MathFunctions -Wl,-Bstatic -lMathFunctions -Wl,-Bdynamic
claus at P3linux:~/src/CMake/Tests/Tutorial/Step3/build>         

As long the dependencies are OK and the makefiles are always new generated if I change a cmake Variable, all is OK.

But this is not true for the compiler used!

I noted, that when I change the CMAKE_CXX_COMPILER value, the old compiler will be used?

Bye
Claus                                             


More information about the CMake mailing list