diff --git a/AMDiS/HOWTO_cmake.html b/AMDiS/HOWTO_cmake.html index a5ef31b1daf3d9627a4b0b24e9a80d7236269070..db82914dfc3f733ecaaa8b507891791abf0986db 100644 --- a/AMDiS/HOWTO_cmake.html +++ b/AMDiS/HOWTO_cmake.html @@ -1,6 +1,9 @@ Using AMDiS with cmake +

Using AMDiS with cmake

@@ -17,25 +20,25 @@ There are 3 different configure tools for CMake:

I will use the cmake and ccmake. The autoconf/automake implementation was used directly inside the AMDiS source directory (i.e. the directory you get through svn). To use the CMake buildsystem, I recommend a different directory structure for building and compiling AMDiS. The script getamdis_cmake.sh, which can be found on gforge.zih.tu-dresden.de, creates such a directory structure.

Assume, you have AMDiS downloaded in the directory -

+

/home/joe/work/

, the AMDiS source directory is -

+

/home/joe/work/amdis/AMDiS

. To configure and compile AMDiS I recommend to create a directory -

+

/home/joe/work/amdis_build

and run -

+

cd /home/joe/work/amdis_build
- cmake -DCMAKE_INSTALL_PREFIX=/home/joe/programs/ ../amdis/AMDiS + cmake -DCMAKE_INSTALL_PREFIX=${HOME}/programs/ ../amdis/AMDiS

Compilation and installation is the same as with automake/autoconf: -

+

make ; make install

The last command will install AMDiS to /home/joe/programs @@ -45,5 +48,45 @@ The last command will install AMDiS to /home/joe/programs If you only want to build with standard options, you can simply run cmake .

Using the cmake installed AMDiS in your project

+A cmake-project consists of the source files and a file CMakeLists.txt, which contains a description of needed libraries, headers and programs. If you have a simple project with one program "fooProg", which have to compile only one source file "src/foo.cc", your CMakeLists.txt consist of the following lines: +

+project(projectName)
+cmake_minimum_required(VERSION 2.8)

+ +find_package(AMDiS REQUIRED)
+if(AMDiS_FOUND)
+ include(${AMDiS_USE_FILE})
+ add_executable(fooProg src/foo.cc)
+ target_link_libraries(fooProg ${AMDiS_LIBRARIES})
+endif(AMDiS_FOUND)
+

+ +The first two lines +

+project(projectName)
+cmake_minimum_required(VERSION 2.8) +

+tell cmake the name of your project and that you whish to use only cmake versions newer than 2.8.
+The line +

+find_package(AMDiS REQUIRED) +

+tells cmake, that you want to use AMDiS and it should complain if AMDiS was not found. CMake will print an error message, bu will not stop the execution! With the command +

+ include(${AMDiS_USE_FILE}) +

+we read an AMDiS specific configuration file, which sets some compilerflags and adds the include directorys. The program is added with +

+ add_executable(fooProg src/foo.cc) +

+and we have to tell cmake, that we need the library amdis and each library amdis depends on. This is done with the command +

+ target_link_libraries(fooProg ${AMDiS_LIBRARIES}) +

+ +If cmake does not find AMDiS, you have to set the variable AMDiS_DIR to the directory containing the file AMDiSConfig.cmake. This file resides in +

+ $CMAKE_INSTALL_PREFIX/share/amdis/ +