
On 31.12.2009, at 07:24, Juergen Schoenwaelder wrote:
On Wed, Dec 30, 2009 at 01:20:46AM +0100, Pau Garcia i Quiles wrote:
I've uploaded the full tarball of libsmi late july 2009 + CMake build system to my website. It's not just one CMakeLists.txt but a few CMakeLists.txt and a few parametrized .cmake files, similar to the .in files for autotools. The "TODOs" at the top of the main CMakeLists.txt are probably outdated.
Thanks for sharing this. Would be cool if people can take a look at this.
To build it:
- Download and install CMake form http://www.cmake.org or your
favorite distribution 2. Download $ wget http://elpauer.org/tmp/libsmi-latejuly09-cmake.tar.bz2 3. Untar $ tar xf libsmi-latejuly09-cmake.tar.bz2 4. Create build directory for out-of-source build $ mkdir build $ cd build 5. Configure $ cmake ../libsmi-latejuly09-cmake
I think this is just 'cmake ..', right?
- Build
$ make
You can change options using "ccmake ." (on Unix-based systems) or "cmake-gui ." (on Unix-based systems and Windows). I implemented the very same options that were available at the time with autotools:
[...]
By default, it seems to built static libraries and link the programs against it. Is there something similar to autotools --enable-shared? There is a definition for "smi" in the CMakeLists but the rules for the binaries depend on "smi_static". Is there an easy way to change this?
That my be useful at the toplevel (PROJECT) CMakeLists.txt file: # setup the build configuration option(BUILD_SHARED_LIBS "Build shared libraries" ON) option(CMAKE_USE_RELATIVE_PATHS "Use relative paths in makefiles" ON) if (MSVC) set(CMAKE_INSTALL_PREFIX "C:/usr" CACHE STRING "Install path prefix" FORCE) endif (MSVC) set(CMAKE_VERBOSE_MAKEFILE ON CACHE INTERNAL "Setup makefile to verbose" FORCE) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) endif(NOT CMAKE_BUILD_TYPE)
A perhaps more difficult question: Can I get cmake to generate a Makefile for cross compiling using mingw? There seems to be a ""MinGW Makefiles" generator but only for Windows.
this page may help: http://www.cmake.org/Wiki/CMake_Cross_Compiling
I think you should try to define your MinGW cross compiler (perhaps with path) and generate 'Unix Makefiles' if you are working under Unix: mkdir crossbuild && cd crossbuild cmake -DCMAKE_C_COMPILER=MinGW-gcc -DCMAKE_CXX_COMPILER=MinGW-c++ .. but I have never used MinGW :-(( //regards Claus