diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..2b7903a21
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+build
+.dir-locals.el
+TAGS
+third-party/blackdynamite/
+third-party/cpp-array/
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000000000..ea4b35afe
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,9 @@
+[submodule "extra_packages/extra-materials"]
+	path = extra_packages/extra-materials
+	url = git@lsmssrv1.epfl.ch:akantu-extra-materials.git
+[submodule "extra_packages/igfem"]
+	path = extra_packages/igfem
+	url = git@lsmssrv1.epfl.ch:akantu-igfem.git
+[submodule "extra_packages/parallel-cohesive-element"]
+	path = extra_packages/parallel-cohesive-element
+	url = git@lsmssrv1.epfl.ch:akantu-parallel-cohesive.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3eb6b972a..cb6ccc0d7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,180 +1,184 @@
 #===============================================================================
 # @file   CMakeLists.txt
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Mon Jun 14 2010
 # @date last modification: Mon Sep 15 2014
 #
 # @brief  main configuration file
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 # @section DESCRIPTION
 #-------------------------------------------------------------------------------
 #                      _               _
 #                     | |             | |
 #                 __ _| | ____ _ _ __ | |_ _   _
 #                / _` | |/ / _` | '_ \| __| | | |
 #               | (_| |   < (_| | | | | |_| |_| |
 #                \__,_|_|\_\__,_|_| |_|\__|\__,_|
 #
 #===============================================================================
 
 #===============================================================================
 # CMake Project
 #===============================================================================
 cmake_minimum_required(VERSION 2.8)
 
 # add this options before PROJECT keyword
 #set(CMAKE_DISABLE_SOURCE_CHANGES ON)
 set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
 
 project(Akantu)
 enable_language(CXX)
 
 #===============================================================================
 # Misc. config for cmake
 #===============================================================================
 set(AKANTU_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake")
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules")
 set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries.")
 mark_as_advanced(BUILD_SHARED_LIBS)
 
 if(NOT AKANTU_TARGETS_EXPORT)
   set(AKANTU_TARGETS_EXPORT AkantuLibraryDepends)
 endif()
 
 include(CMakeVersionGenerator)
 include(CMakePackagesSystem)
 include(CMakeFlagsHandling)
 
 include(AkantuMacros)
 
 #cmake_activate_debug_message()
 
 #===============================================================================
 # Version Number
 #===============================================================================
 # AKANTU version number.  An even minor number corresponds to releases.
 set(AKANTU_MAJOR_VERSION 2)
 set(AKANTU_MINOR_VERSION 2)
 set(AKANTU_PATCH_VERSION 0)
 define_project_version()
 
 #===============================================================================
 # Options
 #===============================================================================
 # Debug
 #option(AKANTU_DEBUG "Compiles akantu with the debug messages" ON)
 #mark_as_advanced(AKANTU_DEBUG)
 
 set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -DAKANTU_NDEBUG"
   CACHE STRING "Flags used by the compiler during release builds" FORCE)
 
 add_flags(cxx "-Wall")
 
 # if(NOT AKANTU_DEBUG)
 #   set(AKANTU_NDEBUG ON)
 # else()
 #   set(AKANTU_NDEBUG OFF)
 # endif()
 
 #Profiling
 set(CMAKE_CXX_FLAGS_PROFILING "-g -pg" CACHE STRING "Flags used by the compiler during profiling builds")
 set(CMAKE_EXE_LINKER_FLAGS_PROFILING "-pg" CACHE STRING "Flags used by the linker during profiling builds")
 set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "-pg" CACHE STRING "Flags used by the linker during profiling builds")
 mark_as_advanced(CMAKE_CXX_FLAGS_PROFILING)
 mark_as_advanced(CMAKE_EXE_LINKER_FLAGS_PROFILING)
 mark_as_advanced(CMAKE_SHARED_LINKER_FLAGS_PROFILING)
 
 include(CMakeDetermineCCompiler)
 cmake_deactivate_debug_message(PackagesSystem)
 #===============================================================================
 # Dependencies
 #===============================================================================
 set(AKANTU_BOOST_COMPONENT)
 set(AKANTU_EXTRA_TARGET_DEPENDENCIES)
-add_all_packages(${PROJECT_SOURCE_DIR}/packages ${PROJECT_SOURCE_DIR}/src)
+
+package_list_packages(${PROJECT_SOURCE_DIR}/packages
+  EXTRA_PACKAGES_FOLDER ${PROJECT_SOURCE_DIR}/extra_packages)
+
+#add_all_packages(${PROJECT_SOURCE_DIR}/packages ${PROJECT_SOURCE_DIR}/src)
 
 include_boost()
 
 ## meta option \todo better way to do it when multiple package give enable the
 ## same feature
 if(AKANTU_SCOTCH)
   set(AKANTU_PARTITIONER ON)
 else()
   set(AKANTU_PARTITIONER OFF)
 endif()
 
 if(AKANTU_MUMPS)
   set(AKANTU_SOLVER ON)
 else()
   set(AKANTU_SOLVER OFF)
 endif()
 
 #===============================================================================
 # Akantu library
 #===============================================================================
 add_subdirectory(src)
 
 #===============================================================================
 # Documentation
 #===============================================================================
 if(AKANTU_DOCUMENTATION_DOXYGEN OR AKANTU_DOCUMENTATION_MANUAL)
   add_subdirectory(doc)
 else()
   set(AKANTU_DOC_EXCLUDE_FILES "${PROJECT_SOURCE_DIR}/doc/manual" CACHE INTERNAL "")
 endif()
 
 #===============================================================================
 # Examples and tests
 #===============================================================================
 option(AKANTU_EXAMPLES "Activate examples" OFF)
 option(AKANTU_TESTS "Activate tests" OFF)
 
 if(AKANTU_EXAMPLES OR AKANTU_TESTS)
   include(AkantuTestAndExamples)
   find_package(GMSH REQUIRED)
 endif()
 
 if(AKANTU_EXAMPLES)
   add_subdirectory(examples)
 endif()
 
 if(AKANTU_TESTS)
   enable_testing()
   include(CTest)
   mark_as_advanced(BUILD_TESTING)
   set(AKANTU_TESTS_EXCLUDE_FILES "" CACHE INTERNAL "")
   add_subdirectory(test)
 else()
   set(AKANTU_TESTS_EXCLUDE_FILES "${PROJECT_SOURCE_DIR}/test" CACHE INTERNAL "")
 endif()
 
 
 #===============================================================================
 # Install and Packaging
 #===============================================================================
 include(AkantuInstall)
 
 if(NOT AKANTU_DISABLE_CPACK)
   include(AkantuCPack)
 endif()
diff --git a/extra_packages/extra-materials b/extra_packages/extra-materials
new file mode 160000
index 000000000..7cb6928a0
--- /dev/null
+++ b/extra_packages/extra-materials
@@ -0,0 +1 @@
+Subproject commit 7cb6928a0d481edea0ead45c4577990acbcbdfc6
diff --git a/extra_packages/igfem b/extra_packages/igfem
new file mode 160000
index 000000000..322526b44
--- /dev/null
+++ b/extra_packages/igfem
@@ -0,0 +1 @@
+Subproject commit 322526b44ea181ffc1072c10255b6aa834783849
diff --git a/extra_packages/parallel-cohesive-element b/extra_packages/parallel-cohesive-element
new file mode 160000
index 000000000..d73b2e0f6
--- /dev/null
+++ b/extra_packages/parallel-cohesive-element
@@ -0,0 +1 @@
+Subproject commit d73b2e0f62c91e1f2beba5db699d76e88beacbbd
diff --git a/packages/00_core.cmake b/packages/00_core.cmake
index b8e823857..37b175dab 100644
--- a/packages/00_core.cmake
+++ b/packages/00_core.cmake
@@ -1,434 +1,432 @@
 #===============================================================================
 # @file   00_core.cmake
 #
 # @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Mon Nov 21 2011
 # @date last modification: Fri Sep 19 2014
 #
 # @brief  package description for core
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-set(AKANTU_CORE ON CACHE INTERNAL "core package for Akantu" FORCE)
+package_declare(core NOT_OPTIONAL DESCRIPTION "core package for Akantu")
 
-set(AKANTU_CORE_FILES
+package_declare_sources(core
   common/aka_array.cc
   common/aka_array.hh
   common/aka_array_tmpl.hh
   common/aka_blas_lapack.hh
   common/aka_circular_array.hh
   common/aka_circular_array_inline_impl.cc
   common/aka_common.cc
   common/aka_common.hh
   common/aka_common_inline_impl.cc
   common/aka_csr.hh
   common/aka_error.cc
   common/aka_error.hh
   common/aka_event_handler_manager.hh
   common/aka_extern.cc
   common/aka_fwd.hh
   common/aka_grid_dynamic.hh
   common/aka_math.cc
   common/aka_math.hh
   common/aka_math_tmpl.hh
   common/aka_memory.cc
   common/aka_memory.hh
   common/aka_memory_inline_impl.cc
   common/aka_random_generator.hh
   common/aka_safe_enum.hh
   common/aka_static_memory.cc
   common/aka_static_memory.hh
   common/aka_static_memory_inline_impl.cc
   common/aka_static_memory_tmpl.hh
   common/aka_typelist.hh
   common/aka_types.hh
   common/aka_visitor.hh
   common/aka_voigthelper.hh
   common/aka_voigthelper.cc
 
   fe_engine/element_class.cc
   fe_engine/element_class.hh
   fe_engine/element_class_tmpl.hh
   fe_engine/element_classes/element_class_hexahedron_8_inline_impl.cc
   fe_engine/element_classes/element_class_pentahedron_6_inline_impl.cc
   fe_engine/element_classes/element_class_point_1_inline_impl.cc
   fe_engine/element_classes/element_class_quadrangle_4_inline_impl.cc
   fe_engine/element_classes/element_class_quadrangle_8_inline_impl.cc
   fe_engine/element_classes/element_class_segment_2_inline_impl.cc
   fe_engine/element_classes/element_class_segment_3_inline_impl.cc
   fe_engine/element_classes/element_class_tetrahedron_10_inline_impl.cc
   fe_engine/element_classes/element_class_tetrahedron_4_inline_impl.cc
   fe_engine/element_classes/element_class_triangle_3_inline_impl.cc
   fe_engine/element_classes/element_class_triangle_6_inline_impl.cc
 
   fe_engine/fe_engine.cc
   fe_engine/fe_engine.hh
   fe_engine/fe_engine_inline_impl.cc
   fe_engine/fe_engine_template.hh
   fe_engine/fe_engine_template_tmpl.hh
   fe_engine/geometrical_data_tmpl.hh
   fe_engine/geometrical_element.cc
   fe_engine/integration_element.cc
   fe_engine/integrator.hh
   fe_engine/integrator_gauss.hh
   fe_engine/integrator_gauss_inline_impl.cc
   fe_engine/interpolation_element.cc
   fe_engine/interpolation_element_tmpl.hh
   fe_engine/shape_functions.hh
   fe_engine/shape_functions_inline_impl.cc
   fe_engine/shape_lagrange.cc
   fe_engine/shape_lagrange.hh
   fe_engine/shape_lagrange_inline_impl.cc
   fe_engine/shape_linked.cc
   fe_engine/shape_linked.hh
   fe_engine/shape_linked_inline_impl.cc
   fe_engine/element.hh
 
   io/dumper/dumpable.hh
   io/dumper/dumpable.cc
   io/dumper/dumpable_inline_impl.hh
   io/dumper/dumper_field.hh
   io/dumper/dumper_material_padders.hh
   io/dumper/dumper_filtered_connectivity.hh
   io/dumper/dumper_element_type.hh
   io/dumper/dumper_element_partition.hh
 
   io/mesh_io.cc
   io/mesh_io.hh
   io/mesh_io/mesh_io_abaqus.cc
   io/mesh_io/mesh_io_abaqus.hh
   io/mesh_io/mesh_io_diana.cc
   io/mesh_io/mesh_io_diana.hh
   io/mesh_io/mesh_io_msh.cc
   io/mesh_io/mesh_io_msh.hh
   io/model_io.cc
   io/model_io.hh
 
   io/parser/algebraic_parser.hh
   io/parser/input_file_parser.hh
   io/parser/parsable.cc
   io/parser/parsable.hh
   io/parser/parsable_tmpl.hh
   io/parser/parser.cc
   io/parser/parser.hh
   io/parser/parser_tmpl.hh
   io/parser/cppargparse/cppargparse.hh
   io/parser/cppargparse/cppargparse.cc
   io/parser/cppargparse/cppargparse_tmpl.hh
 
   mesh/element_group.cc
   mesh/element_group.hh
   mesh/element_group_inline_impl.cc
   mesh/element_type_map.hh
   mesh/element_type_map_tmpl.hh
   mesh/element_type_map_filter.hh
   mesh/group_manager.cc
   mesh/group_manager.hh
   mesh/group_manager_inline_impl.cc
   mesh/mesh.cc
   mesh/mesh.hh
   mesh/mesh_filter.hh
   mesh/mesh_data.cc
   mesh/mesh_data.hh
   mesh/mesh_data_tmpl.hh
   mesh/mesh_inline_impl.cc
   mesh/node_group.cc
   mesh/node_group.hh
   mesh/node_group_inline_impl.cc
 
   mesh_utils/mesh_partition.cc
   mesh_utils/mesh_partition.hh
   mesh_utils/mesh_partition/mesh_partition_mesh_data.cc
   mesh_utils/mesh_partition/mesh_partition_mesh_data.hh
   mesh_utils/mesh_partition/mesh_partition_scotch.hh
   mesh_utils/mesh_pbc.cc
   mesh_utils/mesh_utils.cc
   mesh_utils/mesh_utils.hh
   mesh_utils/mesh_utils_inline_impl.cc
 
   model/boundary_condition.hh
   model/boundary_condition_functor.hh
   model/boundary_condition_functor_inline_impl.cc
   model/boundary_condition_tmpl.hh
   model/integration_scheme/generalized_trapezoidal.hh
   model/integration_scheme/generalized_trapezoidal_inline_impl.cc
   model/integration_scheme/integration_scheme_1st_order.hh
   model/integration_scheme/integration_scheme_2nd_order.hh
   model/integration_scheme/newmark-beta.hh
   model/integration_scheme/newmark-beta_inline_impl.cc
   model/model.cc
   model/model.hh
   model/model_inline_impl.cc
 
   model/solid_mechanics/material.cc
   model/solid_mechanics/material.hh
   model/solid_mechanics/material_inline_impl.cc
   model/solid_mechanics/material_list.hh
   model/solid_mechanics/material_random_internal.hh
   model/solid_mechanics/material_selector.hh
   model/solid_mechanics/material_selector_tmpl.hh
   model/solid_mechanics/materials/internal_field.hh
   model/solid_mechanics/materials/internal_field_tmpl.hh
   model/solid_mechanics/materials/random_internal_field.hh
   model/solid_mechanics/materials/random_internal_field_tmpl.hh
   model/solid_mechanics/solid_mechanics_model.cc
   model/solid_mechanics/solid_mechanics_model.hh
   model/solid_mechanics/solid_mechanics_model_inline_impl.cc
   model/solid_mechanics/solid_mechanics_model_mass.cc
   model/solid_mechanics/solid_mechanics_model_material.cc
   model/solid_mechanics/solid_mechanics_model_tmpl.hh
   model/solid_mechanics/solid_mechanics_model_event_handler.hh
   model/solid_mechanics/materials/plane_stress_toolbox.hh
   model/solid_mechanics/materials/plane_stress_toolbox_tmpl.hh
 
 
   model/solid_mechanics/materials/material_elastic.cc
   model/solid_mechanics/materials/material_elastic.hh
   model/solid_mechanics/materials/material_elastic_inline_impl.cc
   model/solid_mechanics/materials/material_thermal.cc
   model/solid_mechanics/materials/material_thermal.hh
   model/solid_mechanics/materials/material_elastic_linear_anisotropic.cc
   model/solid_mechanics/materials/material_elastic_linear_anisotropic.hh
   model/solid_mechanics/materials/material_elastic_orthotropic.cc
   model/solid_mechanics/materials/material_elastic_orthotropic.hh
   model/solid_mechanics/materials/material_damage/material_damage.hh
   model/solid_mechanics/materials/material_damage/material_damage_tmpl.hh
   model/solid_mechanics/materials/material_damage/material_marigo.cc
   model/solid_mechanics/materials/material_damage/material_marigo.hh
   model/solid_mechanics/materials/material_damage/material_marigo_inline_impl.cc
   model/solid_mechanics/materials/material_damage/material_mazars.cc
   model/solid_mechanics/materials/material_damage/material_mazars.hh
   model/solid_mechanics/materials/material_damage/material_mazars_inline_impl.cc
   model/solid_mechanics/materials/material_finite_deformation/material_neohookean.cc
   model/solid_mechanics/materials/material_finite_deformation/material_neohookean.hh
   model/solid_mechanics/materials/material_finite_deformation/material_neohookean_inline_impl.cc
   model/solid_mechanics/materials/material_plastic/material_plastic.cc
   model/solid_mechanics/materials/material_plastic/material_plastic.hh
   model/solid_mechanics/materials/material_plastic/material_plastic_inline_impl.cc
   model/solid_mechanics/materials/material_plastic/material_linear_isotropic_hardening.cc
   model/solid_mechanics/materials/material_plastic/material_linear_isotropic_hardening.hh
   model/solid_mechanics/materials/material_plastic/material_linear_isotropic_hardening_inline_impl.cc
   model/solid_mechanics/materials/material_viscoelastic/material_standard_linear_solid_deviatoric.cc
   model/solid_mechanics/materials/material_viscoelastic/material_standard_linear_solid_deviatoric.hh
 
-
-
   solver/solver.cc
   solver/solver.hh
   solver/sparse_matrix.cc
   solver/sparse_matrix.hh
   solver/sparse_matrix_inline_impl.cc
   solver/static_solver.hh
   solver/static_solver.cc
 
   synchronizer/communication_buffer.hh
   synchronizer/communication_buffer_inline_impl.cc
   synchronizer/data_accessor.cc
   synchronizer/data_accessor.hh
   synchronizer/data_accessor_inline_impl.cc
   synchronizer/distributed_synchronizer.cc
   synchronizer/distributed_synchronizer.hh
   synchronizer/distributed_synchronizer_tmpl.hh
   synchronizer/dof_synchronizer.cc
   synchronizer/dof_synchronizer.hh
   synchronizer/dof_synchronizer_inline_impl.cc
   synchronizer/filtered_synchronizer.cc
   synchronizer/filtered_synchronizer.hh
   synchronizer/mpi_type_wrapper.hh
   synchronizer/pbc_synchronizer.cc
   synchronizer/pbc_synchronizer.hh
   synchronizer/real_static_communicator.hh
   synchronizer/static_communicator.cc
   synchronizer/static_communicator.hh
   synchronizer/static_communicator_dummy.hh
   synchronizer/static_communicator_inline_impl.hh
   synchronizer/synchronizer.cc
   synchronizer/synchronizer.hh
   synchronizer/synchronizer_registry.cc
   synchronizer/synchronizer_registry.hh
   )
 
 
 set(AKANTU_CORE_DEB_DEPEND
   libboost-dev
   )
 
 set(AKANTU_CORE_TESTS
   test_csr
   test_facet_element_mapping
   test_facet_extraction_tetrahedron_4
   test_facet_extraction_triangle_3
   test_grid
   test_interpolate_stress
   test_local_material
   test_material_damage_non_local
   test_material_thermal
   test_matrix
   test_mesh_boundary
   test_mesh_data
   test_mesh_io_msh
   test_mesh_io_msh_physical_names
   test_mesh_partitionate_mesh_data
   test_parser
   test_dumper
   test_pbc_tweak
   test_purify_mesh
   test_solid_mechanics_model_bar_traction2d
   test_solid_mechanics_model_bar_traction2d_structured
   test_solid_mechanics_model_bar_traction2d_structured_pbc
   test_solid_mechanics_model_boundary_condition
   test_solid_mechanics_model_circle_2
   test_solid_mechanics_model_cube3d
   test_solid_mechanics_model_cube3d_pbc
   test_solid_mechanics_model_cube3d_tetra10
   test_solid_mechanics_model_square
   test_solid_mechanics_model_material_eigenstrain
   test_static_memory
   test_surface_extraction_tetrahedron_4
   test_surface_extraction_triangle_3
   test_vector
   test_vector_iterator
   test_weight
   test_math
   test_material_standard_linear_solid_deviatoric_relaxation
   test_material_standard_linear_solid_deviatoric_relaxation_tension
   test_material_plasticity
   )
 
 set(AKANTU_CORE_MANUAL_FILES
   manual.sty
   manual.cls
   manual.tex
   manual-macros.sty
   manual-titlepages.tex
   manual-introduction.tex
   manual-gettingstarted.tex
   manual-io.tex
   manual-solidmechanicsmodel.tex
   manual-constitutive-laws.tex
   manual-lumping.tex
   manual-elements.tex
   manual-appendix-elements.tex
   manual-appendix-materials.tex
   manual-appendix-packages.tex
   manual-backmatter.tex
   manual-bibliography.bib
   manual-bibliographystyle.bst
 
   figures/bc_and_ic_example.pdf
   figures/boundary.pdf
   figures/boundary.svg
   figures/dirichlet.pdf
   figures/dirichlet.svg
   figures/doc_wheel.pdf
   figures/doc_wheel.svg
   figures/dynamic_analysis.png
   figures/explicit_dynamic.pdf
   figures/explicit_dynamic.svg
   figures/static.pdf
   figures/static.svg
   figures/hooke_law.pdf
   figures/hot-point-1.png
   figures/hot-point-2.png
   figures/implicit_dynamic.pdf
   figures/implicit_dynamic.svg
   figures/insertion.pdf
   figures/interpolate.pdf
   figures/interpolate.svg
   figures/problemDomain.pdf_tex
   figures/problemDomain.pdf
   figures/static_analysis.png
   figures/stress_strain_el.pdf
   figures/tangent.pdf
   figures/tangent.svg
   figures/vectors.pdf
   figures/vectors.svg
 
   figures/stress_strain_neo.pdf
   figures/visco_elastic_law.pdf
   figures/isotropic_hardening_plasticity.pdf
   figures/stress_strain_visco.pdf
 
   figures/elements/hexahedron_8.pdf
   figures/elements/hexahedron_8.svg
   figures/elements/quadrangle_4.pdf
   figures/elements/quadrangle_4.svg
   figures/elements/quadrangle_8.pdf
   figures/elements/quadrangle_8.svg
   figures/elements/segment_2.pdf
   figures/elements/segment_2.svg
   figures/elements/segment_3.pdf
   figures/elements/segment_3.svg
   figures/elements/tetrahedron_10.pdf
   figures/elements/tetrahedron_10.svg
   figures/elements/tetrahedron_4.pdf
   figures/elements/tetrahedron_4.svg
   figures/elements/triangle_3.pdf
   figures/elements/triangle_3.svg
   figures/elements/triangle_6.pdf
   figures/elements/triangle_6.svg
   figures/elements/xtemp.pdf
   )
 
 find_program(READLINK_COMMAND readlink)
 find_program(ADDR2LINE_COMMAND addr2line)
 mark_as_advanced(READLINK_COMMAND)
 mark_as_advanced(ADDR2LINE_COMMAND)
 
 include(CheckFunctionExists)
 
 check_function_exists(clock_gettime _clock_gettime)
 
 if(NOT _clock_gettime)
   set(AKANTU_USE_OBSOLETE_GETTIMEOFDAY ON)
 else()
   set(AKANTU_USE_OBSOLETE_GETTIMEOFDAY OFF)
 endif()
 
 set(AKANTU_CORE_DOCUMENTATION
 "
 This package is the core engine of \\akantu. It depends on:
 \\begin{itemize}
 \\item A C++ compiler (\\href{http://gcc.gnu.org/}{GCC} >= 4, or \\href{https://software.intel.com/en-us/intel-compilers}{Intel}).
 \\item The cross-platform, open-source \\href{http://www.cmake.org/}{CMake} build system.
 \\item The \\href{http://www.boost.org/}{Boost} C++ portable libraries.
 \\item The \\href{http://www.zlib.net/}{zlib} compression library.
 \\end{itemize}
 
 Under Ubuntu (14.04 LTS) the installation can be performed using the commands:
 \\begin{command}
   > sudo apt-get install build-essential cmake-curses-gui libboost-dev zlib1g-dev
 \\end{command}
 
 Under Mac OS X the installation requires the following steps:
 \\begin{itemize}
 \\item Install Xcode
 \\item Install the command line tools.
 \\item Install the MacPorts project which allows to automatically 
 download and install opensource packages. 
 \\end{itemize}
 Then the following commands should be typed in a terminal:
 \\begin{command}
   > sudo port install cmake gcc48 boost
 \\end{command}
 ")
\ No newline at end of file
diff --git a/packages/00_core_cxx11.cmake b/packages/00_core_cxx11.cmake
index 63fa5d402..da65088f8 100644
--- a/packages/00_core_cxx11.cmake
+++ b/packages/00_core_cxx11.cmake
@@ -1,80 +1,86 @@
 #===============================================================================
 # @file   00_core_cxx11.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Mon May 06 2013
 # @date last modification: Thu Jul 03 2014
 #
 # @brief  C++11 addition to the core package
 #
 # @section LICENSE
 #
 # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
 include(CheckCXXCompilerFlag)
 check_cxx_compiler_flag (-std=c++0x HAVE_NEW_STD)
 
-set(AKANTU_CORE_CXX11_FILES
+package_declare_sources(core_cxx11
   common/aka_point.hh
   common/aka_ball.cc
   common/aka_ci_string.hh
   common/aka_plane.hh
   common/aka_polytope.hh
   common/aka_ball.hh
   common/aka_timer.hh
   common/aka_tree.hh
   common/aka_bounding_box.hh
   common/aka_bounding_box.cc
   common/aka_geometry.hh
   common/aka_geometry.cc
   model/solid_mechanics/solid_mechanics_model_element.hh
   )
 
 
 if(HAVE_NEW_STD)
-  option(AKANTU_CORE_CXX11 "C++ 11 additions for Akantu core" ON)
+  package_declare(core_cxx11 ADVANCED
+    DESCRIPTION "C++ 11 additions for Akantu core" DEFAULT ON)
 
   if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
     if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.6")
       set(AKANTU_CORE_CXX11 OFF CACHE BOOL "C++ 11 additions for Akantu core - not supported by the selected compiler" FORCE)
     elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.8")
       if(AKANTU_CORE_CXX11)
 	add_flags(cxx -DBOOST_RESULT_OF_USE_TR1)
       else()
 	remove_flags(cxx -DBOOST_RESULT_OF_USE_TR1)
       endif()
     endif()
   endif()
 
-  if(AKANTU_CORE_CXX11)
+  package_get_name(core_cxx11 _pkg_name)
+  package_get_option_name(${_pkg_name} _option_name)
+
+  if(${_option_name})
     add_flags(cxx "-std=c++0x")
   else()
     remove_flags(cxx "-std=c++0x")
   endif()
 else()
-  set(AKANTU_CORE_CXX11 OFF CACHE BOOL "core package for Akantu" FORCE)
+  package_declare(core_cxx11 ADVANCED
+    DESCRIPTION "C++ 11 additions for Akantu core"
+    DEFAULT OFF
+    NOT_OPTIONAL)
+
   remove_flags(cxx "-std=c++0x")
 endif()
 
-mark_as_advanced(AKANTU_CORE_CXX11)
-
 set(AKANTU_CORE_CXX11_DOCUMENTATION "
 This option activates some features of the C++11 standard. This is usable with GCC>=4.7 or Intel>=13.")
 
diff --git a/packages/00_documentation_doxygen.cmake b/packages/00_documentation_doxygen.cmake
index 0e3380df8..ae4007abb 100644
--- a/packages/00_documentation_doxygen.cmake
+++ b/packages/00_documentation_doxygen.cmake
@@ -1,47 +1,48 @@
 #===============================================================================
 # @file   00_documentation_doxygen.cmake
 #
 # @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
 #
 # @date creation: Tue Jun 10 2014
 # @date last modification: Tue Jun 24 2014
 #
 # @brief  Doxygen documentation of the code
 #
 # @section LICENSE
 #
 # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-option(AKANTU_DOCUMENTATION_DOXYGEN "Build source documentation using Doxygen." OFF)
+package_declare(documentation_doxygen
+  DESCRIPTION "Build source documentation using Doxygen.")
 
 set(AKANTU_DOCUMENTATION_DOXYGEN_DOCUMENTATION
 "
 This generates the Doxygen documantation of the source code.
 It depends on:
 \\begin{itemize}
 \\item \\href{http://www.stack.nl/~dimitri/doxygen/}{Doxygen} an automated source code documentations system.
 \\item Optional: \\href{http://www.graphviz.org/}{Graphviz} to generate the dependencies graph
 \\end{itemize}
 
 Under Ubuntu (14.04 LTS), the installation of the dependencies can be performed using the following command:
 \\begin{command}
   > sudo apt-get install doxygen
   > sudo apt-get install graphviz
 \\end{command}
 ")
\ No newline at end of file
diff --git a/packages/00_documentation_manual.cmake b/packages/00_documentation_manual.cmake
index eeef47666..02dde1350 100644
--- a/packages/00_documentation_manual.cmake
+++ b/packages/00_documentation_manual.cmake
@@ -1,39 +1,40 @@
 #===============================================================================
 # @file   00_documentation_manual.cmake
 #
 # @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
 #
 # @date creation: Tue Jun 10 2014
 # @date last modification: Thu Jul 03 2014
 #
 # @brief  Akantu's manual package
 #
 # @section LICENSE
 #
 # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-option(AKANTU_DOCUMENTATION_MANUAL  "Build manual." OFF)
+package_declare(documentation_manual
+  DESCRIPTION "Build the user manual.")
 
 set(AKANTU_DOCUMENTATION_MANUAL_DOCUMENTATION "
 This package alows to compile the user manual in the build folder \\shellcode{build/doc/manual/manual.pdf}.
 
 Under Ubuntu (14.04 LTS), the installation of the dependencies can be performed using the following command:
 \\begin{command}
   > sudo apt-get install install rubber texlive texlive-science texlive-latex-extra
 \\end{command}")
\ No newline at end of file
diff --git a/packages/10_heat_transfer.cmake b/packages/10_heat_transfer.cmake
index 4b24506b4..40a8216b0 100644
--- a/packages/10_heat_transfer.cmake
+++ b/packages/10_heat_transfer.cmake
@@ -1,59 +1,60 @@
 #===============================================================================
 # @file   10_heat_transfer.cmake
 #
 # @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
 #
 # @date creation: Mon Nov 21 2011
 # @date last modification: Thu Jun 12 2014
 #
 # @brief  package description for heat transfer
 #
 # @section LICENSE
 #
 # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-option(AKANTU_HEAT_TRANSFER "Use Heat Transfer package of Akantu" OFF)
+package_declare(heat_transfer
+  DESCRIPTION "Use Heat Transfer package of Akantu")
 
-set(AKANTU_HEAT_TRANSFER_FILES
+package_declare_sources(heat_transfer
   model/heat_transfer/heat_transfer_model.cc
   model/heat_transfer/heat_transfer_model.hh
   model/heat_transfer/heat_transfer_model_inline_impl.cc
   )
 
 set(AKANTU_HEAT_TRANSFER_DOC
   manual/manual-heattransfermodel.tex
   )
 
 set(AKANTU_HEAT_TRANSFER_TESTS
    test_heat_transfer_model_cube3d
    test_heat_transfer_model_cube3d_pbc
    test_heat_transfer_model_square2d_pbc
    test_heat_transfer_model_square2d
    test_heat_transfer_model_cube3d_istropic_conductivity
    )
 
 set(AKANTU_HEAT_TRANSFER_MANUAL_FILES
   manual-heattransfermodel.tex
 )
 
 set(AKANTU_HEAT_TRANSFER_DOCUMENTATION 
 "
 This package activates the heat transfer model within Akantu. 
 It has no additional dependencies.
 ")
\ No newline at end of file
diff --git a/packages/10_structural_mechanics.cmake b/packages/10_structural_mechanics.cmake
index 3578e4930..a6115e8df 100644
--- a/packages/10_structural_mechanics.cmake
+++ b/packages/10_structural_mechanics.cmake
@@ -1,80 +1,80 @@
 #===============================================================================
 # @file   10_structural_mechanics.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Mon Nov 21 2011
 # @date last modification: Mon Jul 07 2014
 #
 # @brief  package description for structural mechanics
 #
 # @section LICENSE
 #
 # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-option(AKANTU_STRUCTURAL_MECHANICS "Use Structural mechanics model package of Akantu" OFF)
+package_declare(structural_mechanics
+  DESCRIPTION "Use Structural mechanics model package of Akantu"
+  DEPENDS implicit)
 
-add_internal_package_dependencies(STRUCTURAL_MECHANICS IMPLICIT)
-
-set(AKANTU_STRUCTURAL_MECHANICS_FILES
+package_declare_sources(structural_mechanics
   fe_engine/element_class_structural.hh
   fe_engine/element_classes/element_class_bernoulli_beam_inline_impl.cc
   fe_engine/fe_engine_template_tmpl_struct.hh
   fe_engine/element_classes/element_class_kirchhoff_shell_inline_impl.cc
   io/mesh_io/mesh_io_msh_struct.cc
   io/mesh_io/mesh_io_msh_struct.hh
   io/model_io/model_io_ibarras.cc
   io/model_io/model_io_ibarras.hh
   model/structural_mechanics/structural_mechanics_model.cc
   model/structural_mechanics/structural_mechanics_model.hh
   model/structural_mechanics/structural_mechanics_model_boundary.cc
   model/structural_mechanics/structural_mechanics_model_inline_impl.cc
   model/structural_mechanics/structural_mechanics_model_mass.cc
   )
 
 set(AKANTU_STRUCTURAL_MECHANICS_DOC
   manual/manual-structuralmechanicsmodel.tex
   )
 
 set(AKANTU_STRUCTURAL_MECHANICS_TESTS
   test_structural_mechanics_model_bernoulli_beam_2
   test_structural_mechanics_model_boundary_bernoulli_beam_2
   test_structural_mechanics_model_bernoulli_beam_2_exemple_1_1
   test_structural_mechanics_model_bernoulli_beam_2_complicated
   test_structural_mechanics_model_bernoulli_beam_2_exemple_1_1_y
   test_structural_mechanics_model_bernoulli_beam_3_exemple_1_1_xy
   test_structural_mechanics_model_bernoulli_beam_3_exemple_1_1_zy
   test_structural_mechanics_model_bernoulli_beam_3_local_force
   test_structural_mechanics_model_bernoulli_beam_3_exercice_12_10_13 
   test_structural_mechanics_model_kirchhoff_shell_patch_test_4_5_5
   test_structural_mechanics_model_bernoulli_beam_dynamics
   )
 
 set(AKANTU_STRUCTURAL_MECHANICS_MANUAL_FILES
   manual-structuralmechanicsmodel.tex
   manual-structuralmechanicsmodel-elements.tex
 
   figures/beam_example.pdf
   figures/elements/bernoulli_2.pdf
   figures/elements/bernoulli_2.svg
   )
-  
+
 set(AKANTU_STRUCTURAL_MECHANICS_DOCUMENTATION "
 This package activates the compilation for the Structural Mechanics engine of Akantu
 ")
diff --git a/packages/20_cohesive_element.cmake b/packages/20_cohesive_element.cmake
index 66198a823..340568cb9 100644
--- a/packages/20_cohesive_element.cmake
+++ b/packages/20_cohesive_element.cmake
@@ -1,109 +1,110 @@
 #===============================================================================
 # @file   20_cohesive_element.cmake
 #
 # @author Marco Vocialta <marco.vocialta@epfl.ch>
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Tue Oct 16 2012
 # @date last modification: Tue Sep 02 2014
 #
 # @brief  package description for cohesive elements
 #
 # @section LICENSE
 #
 # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-option(AKANTU_COHESIVE_ELEMENT "Use cohesive_element package of Akantu" OFF)
-add_external_package_dependencies(cohesive_element lapack)
+package_declare(cohesive_element
+  DESCRIPTION "Use cohesive_element package of Akantu"
+  DEPENDS lapack)
 
-set(AKANTU_COHESIVE_ELEMENT_FILES
+package_declare_sources(cohesive_element
   model/solid_mechanics/materials/material_cohesive_includes.hh
 
   mesh_utils/cohesive_element_inserter.hh
   mesh_utils/cohesive_element_inserter.cc
 
   fe_engine/cohesive_element.cc
   fe_engine/shape_cohesive.hh
   fe_engine/cohesive_element.hh
   fe_engine/fe_engine_template_cohesive.cc
 
   fe_engine/shape_cohesive_inline_impl.cc
 
   model/solid_mechanics/materials/material_cohesive/cohesive_internal_field_tmpl.hh
   model/solid_mechanics/materials/material_cohesive/cohesive_internal_field.hh
 
   model/solid_mechanics/materials/material_cohesive/material_cohesive_inline_impl.cc
 
   model/solid_mechanics/solid_mechanics_model_cohesive.cc
   model/solid_mechanics/fragment_manager.cc
   model/solid_mechanics/materials/material_cohesive/material_cohesive.cc
   model/solid_mechanics/materials/material_cohesive/constitutive_laws/material_cohesive_linear.cc
   model/solid_mechanics/materials/material_cohesive/constitutive_laws/material_cohesive_bilinear.cc
   model/solid_mechanics/materials/material_cohesive/constitutive_laws/material_cohesive_exponential.cc
 
   model/solid_mechanics/solid_mechanics_model_cohesive.hh
   model/solid_mechanics/fragment_manager.hh
   model/solid_mechanics/materials/material_cohesive/material_cohesive.hh
   model/solid_mechanics/materials/material_cohesive/constitutive_laws/material_cohesive_bilinear.hh
   model/solid_mechanics/materials/material_cohesive/constitutive_laws/material_cohesive_linear.hh
   model/solid_mechanics/materials/material_cohesive/constitutive_laws/material_cohesive_exponential.hh
 
 #  io/dumper/dumper_iohelper_tmpl_connectivity_field.hh
   )
 
 
 set(AKANTU_COHESIVE_ELEMENT_TESTS
   test_cohesive_buildfacets_tetrahedron
   test_cohesive_buildfacets_hexahedron
   test_cohesive_intrinsic
   test_cohesive_intrinsic_quadrangle
   test_cohesive_extrinsic
   test_cohesive_extrinsic_quadrangle
   test_cohesive_buildfragments
   test_cohesive_intrinsic_impl
   )
 
 set(AKANTU_COHESIVE_ELEMENT_DOC
   manual/manual-cohesive_elements.tex
   manual/manual-cohesive_elements_insertion.tex
   manual/manual-cohesive_laws.tex
   manual/manual-appendix-materials-cohesive.tex
   )
 
 set(AKANTU_COHESIVE_ELEMENT_MANUAL_FILES
   manual-cohesive_elements.tex
   manual-cohesive_elements_insertion.tex
   manual-cohesive_laws.tex
   manual-appendix-materials-cohesive.tex
 
   figures/cohesive2d.pdf
   figures/cohesive_exponential.pdf
   figures/linear_cohesive_law.pdf
   figures/bilinear_cohesive_law.pdf
   )
 
 
 set(AKANTU_COHESIVE_ELEMENT_DOCUMENTATION
 "This package activates the cohesive elements engine within Akantu.
 It depends on:
 \\begin{itemize}
 \\item A fortran compiler.
 \\item An implementation of BLAS/LAPACK.
 \\end{itemize}
 ")
diff --git a/packages/20_contact.cmake b/packages/20_contact.cmake
index 53bbac44b..69e27e32c 100644
--- a/packages/20_contact.cmake
+++ b/packages/20_contact.cmake
@@ -1,99 +1,98 @@
 #===============================================================================
 # @file   20_contact.cmake
 #
 # @author Alejandro M. Aragón <alejandro.aragon@epfl.ch>
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Mon Nov 21 2011
 # @date last modification: Mon Sep 15 2014
 #
 # @brief  package description for contact
 #
 # @section LICENSE
 #
 # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-option(AKANTU_CONTACT "Use Contact package of Akantu" OFF)
+package_declare(contact
+  DESCRIPTION "Use Contact package of Akantu"
+  DEPENDS cpparray implicit optimization)
 
-set(AKANTU_CONTACT_FILES
+
+package_declare_sources(contact
   #cc files
   contact/discretization.cc
   contact/element.cc
   contact/friction.cc
   contact/resolution/resolution_augmented_lagrangian.cc
   contact/scheme.cc
   contact/search.cc
   contact/surface.cc
   contact/zone.cc
   contact/contact_impl.cc
   model/model_manager.cc
 
   # include files
   contact/contact_common.hh
   contact/contact_manager.hh
   contact/discretization.hh
   contact/element.hh
   contact/friction.hh
   contact/resolution.hh
   contact/resolution/resolution_augmented_lagrangian.hh
   contact/scheme.hh
   contact/search.hh
   contact/surface.hh
   contact/zone.hh
   contact/contact_impl.hh
   model/model_manager.hh
   model/contact_manager0.hh
   )
 
-add_external_package_dependencies(contact cpparray)
-add_internal_package_dependencies(contact implicit)
-add_internal_package_dependencies(contact optimization)
 
 if(AKANTU_CONTACT)
   list(APPEND AKANTU_BOOST_COMPONENTS
     chrono
     system
     )
 endif()
 
-mark_as_advanced(AKANTU_USE_CPPARRAY)
 
 set(AKANTU_CONTACT_TESTS
   test_hertz_2D
   test_hertz_3D
   test_offset_1slave
   test_offset_2slaves
   test_acurnier_2D_1
   test_acurnier_2D_2
   test_acurnier_2D_3
   test_acurnier_3D_1
   test_acurnier_3D_2
   test_acurnier_3D_3
   )
 
 set(AKANTU_CONTACT_MANUAL_FILES
   manual-contact.tex
 
   figures/hertz_3D.png
 )
 
 set(AKANTU_CONTACT_DOCUMENTATION
 "
 This package enables the contact mechanics engine for Akantu
 ")
\ No newline at end of file
diff --git a/packages/25_damage_non_local.cmake b/packages/25_damage_non_local.cmake
index 75be7965f..4de673ec6 100644
--- a/packages/25_damage_non_local.cmake
+++ b/packages/25_damage_non_local.cmake
@@ -1,65 +1,65 @@
 #===============================================================================
 # @file   25_damage_non_local.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Fri Jun 15 2012
 # @date last modification: Fri Jun 13 2014
 #
 # @brief  package description for non-local materials
 #
 # @section LICENSE
 #
 # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-option(AKANTU_DAMAGE_NON_LOCAL "Package for Non-local damage constitutives laws Akantu" OFF)
+package_declare(damage_non_local
+  DESCRIPTION "Package for Non-local damage constitutives laws Akantu"
+  DEPENDS lapack)
 
-add_external_package_dependencies(damage_non_local lapack)
-
-set(AKANTU_DAMAGE_NON_LOCAL_FILES
+package_declare_sources(damage_non_local
   model/solid_mechanics/materials/material_damage/material_damage_non_local.hh
   model/solid_mechanics/materials/material_damage/material_marigo_non_local.hh
   model/solid_mechanics/materials/material_damage/material_marigo_non_local_inline_impl.cc
   model/solid_mechanics/materials/material_damage/material_mazars_non_local.cc
   model/solid_mechanics/materials/material_damage/material_mazars_non_local.hh
 
   model/solid_mechanics/materials/material_non_local.hh
   model/solid_mechanics/materials/material_non_local_includes.hh
   model/solid_mechanics/materials/material_non_local_inline_impl.cc
 
   model/solid_mechanics/materials/weight_function.cc
   model/solid_mechanics/materials/weight_function.hh
   model/solid_mechanics/materials/weight_function_tmpl.hh
 
   synchronizer/grid_synchronizer.cc
   synchronizer/grid_synchronizer.hh
   )
 
 set(AKANTU_DAMAGE_NON_LOCAL_TESTS
   test_material_damage_non_local
   test_grid_synchronizer
   )
 
 set(AKANTU_DAMAGE_NON_LOCAL_MANUAL_FILES
   manual-constitutive-laws-non_local.tex
   manual-appendix-materials-non-local.tex)
 
 set(AKANTU_DAMAGE_NON_LOCAL_DOCUMENTATION "
 This package activates the non local damage feature of AKANTU
 ")
diff --git a/packages/40_optimization.cmake b/packages/40_optimization.cmake
index 90e1bd75d..9b8960d61 100644
--- a/packages/40_optimization.cmake
+++ b/packages/40_optimization.cmake
@@ -1,44 +1,46 @@
 #===============================================================================
 # @file   40_optimization.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Fri Jan 04 2013
 # @date last modification: Wed Jul 30 2014
 #
 # @brief  Optimization external library interface
 #
 # @section LICENSE
 #
 # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-option(AKANTU_OPTIMIZATION "Use optimization package in Akantu" OFF)
+package_declare(optimization
+  DESCRIPTION "Use optimization package in Akantu"
+  DEPENDS nlopt
+  ADVANCED)
 
-set(AKANTU_OPTIMIZATION_FILES
+
+package_declare_sources(optimization
   common/aka_optimize.hh
   common/aka_optimize.cc
   )
 
-add_external_package_dependencies(optimization nlopt)
-mark_as_advanced(AKANTU_OPTIMIZATION)
 
 set(AKANTU_OPTIMIZATION_DOCUMENTATION "
 This activates the optimization routines of Akantu. This is currently needed by the 
 contact detection algorithms.
 " )
diff --git a/packages/50_implicit.cmake b/packages/50_implicit.cmake
index de84fd7e9..d6f51eb1d 100644
--- a/packages/50_implicit.cmake
+++ b/packages/50_implicit.cmake
@@ -1,48 +1,50 @@
 #===============================================================================
 # @file   50_implicit.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Tue Oct 16 2012
 # @date last modification: Thu Jun 12 2014
 #
 # @brief  package description for the implicit solver
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-add_meta_package(IMPLICIT "Add support for implicit time scheme" OFF SCOTCH MUMPS)
+package_declare(implicit META
+  DESCRIPTION "Add support for implicit time scheme"
+  DEPENDS scotch mumps)
 
 set(AKANTU_IMPLICIT_TESTS
   test_solid_mechanics_model_bar_traction2d_mass_not_lumped
   test_solid_mechanics_model_implicit_1d
   test_solid_mechanics_model_implicit_2d
   test_solid_mechanics_model_implicit_dynamic_2d
   )
 
-set(AKANTU_IMPLICIT_DOCUMENTATION 
+set(AKANTU_IMPLICIT_DOCUMENTATION
 "
 This package activates the sparse solver necessary to solve implicitely static/dynamic finite element problems.
 It depends on:
 \\begin{itemize}
 \\item \\href{http://mumps.enseeiht.fr/}{MUMPS}, a parallel sparse direct solver.
 \\item \\href{http://www.labri.fr/perso/pelegrin/scotch/}{Scotch}, a graph partitioner.
 \\end{itemize}
 ")
\ No newline at end of file
diff --git a/packages/50_parallel.cmake b/packages/50_parallel.cmake
index 2a91df104..e6b621746 100644
--- a/packages/50_parallel.cmake
+++ b/packages/50_parallel.cmake
@@ -1,48 +1,50 @@
 #===============================================================================
 # @file   50_parallel.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Tue Oct 16 2012
 # @date last modification: Wed Jun 11 2014
 #
 # @brief  meta package description for parallelization
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-add_meta_package(PARALLEL "Add parallel support in Akantu" OFF MPI SCOTCH)
+package_declare(parallel META
+  DESCRIPTION "Add parallel support in Akantu"
+  DEPENDS mpi scotch)
 
 set(AKANTU_PARALLEL_TESTS
   test_solid_mechanics_model_bar_traction2d_parallel
   test_solid_mechanics_model_segment_parallel
   test_solid_mechanics_model_pbc_parallel
   test_synchronizer_communication
   test_dof_synchronizer
   test_solid_mechanics_model_reassign_material
   )
 
 set(AKANTU_PARALLEL_MANUAL_FILES
   manual-parallel.tex
   )
 
 set(AKANTU_PARALLEL_DOCUMENTATION "
 This option activates the parallel features of AKANTU.
 " )
diff --git a/packages/80_cpparray.cmake b/packages/80_cpparray.cmake
index 74717a60f..fc27858e8 100644
--- a/packages/80_cpparray.cmake
+++ b/packages/80_cpparray.cmake
@@ -1,83 +1,81 @@
 #===============================================================================
 # @file   cpp_array.cmake
 #
 # @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date   Mon Nov 21 18:19:15 2011
 #
 # @brief  package description for cpp_array project
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
-option(AKANTU_USE_CPPARRAY "Use cpp-array library" OFF)
-option(AKANTU_USE_THIRD_PARTY_CPPARRAY "Automatic download of the CPP-ARRAY library" ON)
-mark_as_advanced(AKANTU_USE_THIRD_PARTY_CPPARRAY AKANTU_USE_CPPARRAY)
+package_declare(CppArray EXTERNAL
+  DESCRIPTION "Use cpp-array library"
+  SYSTEM OFF)
 
 if(AKANTU_USE_CPPARRAY AND AKANTU_USE_THIRD_PARTY_CPPARRAY)
   find_package(Git)
 
   if(GIT_FOUND)
     if(EXISTS ${PROJECT_SOURCE_DIR}/third-party/cpp-array)
       execute_process(
 	COMMAND ${GIT_EXECUTABLE} pull
 	WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/third-party/cpp-array
 	OUTPUT_VARIABLE _revision)
       message(STATUS "Updating Cpp-Array")
     else()
       message(STATUS "Cloning Cpp-Array")
       execute_process(
 	COMMAND ${GIT_EXECUTABLE} clone https://code.google.com/p/cpp-array.git ${PROJECT_SOURCE_DIR}/third-party/cpp-array
 	OUTPUT_QUIET)
     endif()
   endif()
 
   if(EXISTS ${PROJECT_SOURCE_DIR}/third-party/cpp-array/)
     set(cpp-array_TESTS OFF CACHE BOOL "cpparray tests" FORCE)
     add_subdirectory(${PROJECT_SOURCE_DIR}/third-party/cpp-array/)
     set(cpp-array_TESTS OFF CACHE BOOL "cpparray tests" FORCE)
 
     mark_as_advanced(cpp-array_DEV)
     mark_as_advanced(cpp-array_DOCUMENTATION)
     mark_as_advanced(cpp-array_TESTS)
     mark_as_advanced(CUDA)
     mark_as_advanced(ARRAY_USER_LIB_PATH)
 
     list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${cpp-array_INCLUDE_DIRS} ${CPP-ARRAY_INCLUDE_DIRS})
     list(APPEND AKANTU_EXTERNAL_LIBRARIES ${CPP-ARRAY_LIBRARIES})
     list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${CPP-ARRAY_INCLUDE_DIRS})
     list(APPEND CPACK_SOURCE_IGNORE_FILES ${PROJECT_SOURCE_DIR}/third-party/cpp-array/)
     set(AKANTU_CPPARRAY_INCLUDE_DIR ${cpp-array_INCLUDE_DIRS} ${CPP-ARRAY_INCLUDE_DIRS})
 
 
     set(AKANTU_CPPARRAY ON)
     list(APPEND AKANTU_OPTION_LIST CPPARRAY)
     set(AKANTU_CPPARRAY ${AKANTU_CPPARRAY} CACHE INTERNAL "Use cpp-array library" FORCE)
   else()
     message(STATUS "Cpp-Array could not be found! Please install git and/or place cpp-array in the third-party folder of Akantu")
   endif()
-else()
-  add_optional_external_package(CppArray "Use cpp-array library" OFF)
 endif()
 
 
 set(AKANTU_CPPARRAY_DOCUMENTATION "
 This package provides access to the \\href{https://code.google.com/p/cpp-array/}{cpp-array} open-source project. If internet is accessible when configuring the project (during cmake call) this package will be auto-downloaded.
 ")
diff --git a/packages/80_mpi.cmake b/packages/80_mpi.cmake
index 07fe38fb2..8c4ff94ba 100644
--- a/packages/80_mpi.cmake
+++ b/packages/80_mpi.cmake
@@ -1,57 +1,61 @@
 #===============================================================================
 # @file   80_mpi.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Mon Nov 21 2011
 # @date last modification: Sat Jun 14 2014
 #
 # @brief  package description for mpi
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
 if(AKANTU_USE_THIRD_PARTY_MUMPS)
   enable_language(Fortran)
 endif()
 
-add_optional_external_package(MPI "Add MPI support in akantu" OFF PREFIX MPI_C MPI DEPENDS SCOTCH)
-set(AKANTU_MPI_FILES
+package_declare(MPI EXTERNAL
+  DESCRIPTION "Add MPI support in akantu"
+  EXTRA_PACKAGE_OPTIONS PREFIX MPI_C MPI
+  DEPENDS scotch)
+
+package_declare_sources(MPI
   synchronizer/static_communicator_mpi.cc
   synchronizer/static_communicator_mpi_inline_impl.hh
   synchronizer/static_communicator_mpi.hh
   )
 
 mark_as_advanced(MPI_EXTRA_LIBRARY MPI_LIBRARY)
 
 set(AKANTU_MPI_DOCUMENTATION 
 "
 This is a meta package providing access to MPI.
 
 Under Ubuntu (14.04 LTS) the installation can be performed using the commands:
 \\begin{command}
   > sudo apt-get install libopenmpi-dev
 \\end{command}
 
 Under Mac OS X the installation requires the following steps:
 \\begin{command}
   > sudo port install mpich-devel
 \\end{command}
 ")
diff --git a/packages/80_nlopt.cmake b/packages/80_nlopt.cmake
index fa223e4f9..0272994eb 100644
--- a/packages/80_nlopt.cmake
+++ b/packages/80_nlopt.cmake
@@ -1,82 +1,79 @@
 #===============================================================================
 # @file   80_nlopt.cmake
 #
 # @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Thu Jun 05 2014
 # @date last modification: Thu Sep 18 2014
 #
 # @brief  package for the opitmization library NLopt
 #
 # @section LICENSE
 #
 # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
-
-option(AKANTU_USE_THIRD_PARTY_NLOPT "Automatic download of the NLOPT library" ON)
-option(AKANTU_USE_NLOPT "Use NLOPT library" OFF)
-mark_as_advanced(AKANTU_USE_THIRD_PARTY_NLOPT AKANTU_USE_NLOPT)
+package_declare(nlopt EXTERNAL
+  DESCRIPTION "Use NLOPT library"
+  SYSTEM OFF)
 
 set(NLOPT_VERSION "2.4.2")
 set(NLOPT_ARCHIVE "${PROJECT_SOURCE_DIR}/third-party/nlopt-${NLOPT_VERSION}.tar.gz")
 set(NLOPT_ARCHIVE_HASH "MD5=d0b8f139a4acf29b76dbae69ade8ac54")
 if(NOT EXISTS ${NLOPT_ARCHIVE})
   set(NLOPT_ARCHIVE "http://ab-initio.mit.edu/nlopt/nlopt-${NLOPT_VERSION}.tar.gz")
 endif()
 
 if (AKANTU_USE_THIRD_PARTY_NLOPT AND AKANTU_USE_NLOPT)
   set(NLOPT_CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --enable-shared --with-cxx)
   set(NLOPT_DIR ${PROJECT_BINARY_DIR}/third-party)
 
   include(ExternalProject)
 
   ExternalProject_Add(NLopt
     PREFIX ${NLOPT_DIR}
     URL ${NLOPT_ARCHIVE}
     URL_HASH ${NLOPT_ARCHIVE_HASH}
     CONFIGURE_COMMAND ${NLOPT_CONFIGURE_COMMAND}
     BUILD_COMMAND make
     INSTALL_COMMAND make install
     )
 
   set(NLOPT_LIBRARIES   ${NLOPT_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}nlopt_cxx${CMAKE_SHARED_LIBRARY_SUFFIX} CACHE PATH "Libraries for NLopt" FORCE)
   set(NLOPT_INCLUDE_DIR ${NLOPT_DIR}/include CACHE PATH "Include directories for NLopt" FORCE)
 
   mark_as_advanced(NLOPT_INCLUDE_DIR NLOPT_LIBRARIES)
 
   list(APPEND AKANTU_EXTERNAL_LIBRARIES ${NLOPT_LIBRARIES})
   list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${NLOPT_INCLUDE_DIR})
   set(AKANTU_NLOPT_INCLUDE_DIR ${NLOPT_INCLUDE_DIR})
   set(AKANTU_NLOPT_LIBRARIES ${NLOPT_LIBRARIES})
   list(APPEND AKANTU_OPTION_LIST NLOPT)
   set(NLOPT_FOUND TRUE CACHE INTERNAL "" FORCE)
   set(AKANTU_NLOPT ON)
 
   list(APPEND AKANTU_EXTRA_TARGET_DEPENDENCIES NLopt)
-else()
-  add_optional_external_package(NLopt "Use NLOPT library" OFF)
 endif()
 
 
 set(AKANTU_NLOPT_DOCUMENTATION "
 This package enable the use of the optimization alogorithm library \\href{http://ab-initio.mit.edu/wiki/index.php/NLopt}{NLopt}.
 Since there are no packaging for the common operating system by default \\akantu compiles it as a third-party project. This behavior can be modified with the option \\code{AKANTU\\_USE\\_THIRD\\_PARTY\\_NLOPT}.
 
 If the automated download fails please download \\href{http://ab-initio.mit.edu/nlopt/nlopt-${NLOPT_VERSION}.tar.gz}{nlopt-${NLOPT_VERSION}.tar.gz} and place it in \\shellcode{<akantu source>/third-party} download.
 ")
diff --git a/packages/84_petsc.cmake b/packages/84_petsc.cmake
index dceacb9ba..78253a191 100644
--- a/packages/84_petsc.cmake
+++ b/packages/84_petsc.cmake
@@ -1,45 +1,48 @@
 #===============================================================================
 # @file   petsc.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 # @author Alejandro M. Aragón <alejandro.aragon@epfl.ch>
 # @author Aurelia Cuba Ramos <aurelia.cubaramos@epfl.ch>
 #
 # @date   Mon Nov 21 18:19:15 2011
 #
 # @brief  package description for PETSc support
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-add_optional_external_package(PETSc "Add PETSc support in akantu" OFF ARGS COMPONENT ARGS CXX)
-add_internal_package_dependencies(petsc parallel)
+package_declare(PETSc EXRENAL
+  DESCRIPTION "Add PETSc support in akantu"
+  ARGS COMPONENT CXX
+  DEPENDS parallel)
 
-set(AKANTU_PETSC_FILES
+
+package_declare_sources(petsc
   solver/petsc_matrix.hh
   solver/petsc_matrix.cc
   solver/petsc_matrix_inline_impl.cc
   solver/solver_petsc.hh
   solver/solver_petsc.cc
   )
 
 set(AKANTU_PETSC_TESTS
   test_petsc_matrix_profile
   )
diff --git a/packages/85_mumps.cmake b/packages/85_mumps.cmake
index 7b59c554d..92f5c1d11 100644
--- a/packages/85_mumps.cmake
+++ b/packages/85_mumps.cmake
@@ -1,203 +1,202 @@
 #===============================================================================
 # @file   85_mumps.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Mon Nov 21 2011
 # @date last modification: Mon Sep 15 2014
 #
 # @brief  package description for mumps support
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-set(AKANTU_MUMPS_FILES
+package_declare_sources(Mumps
   solver/solver_mumps.cc
   solver/solver_mumps.hh
   )
 
-option(AKANTU_USE_THIRD_PARTY_MUMPS "Use the third-party Mumps instead of the one from the system" OFF)
-option(AKANTU_USE_MUMPS "Add Mumps support in akantu")
+
+package_declare(Mumps EXTERNAL
+  DESCRIPTION "Add Mumps support in akantu"
+  SYSTEM ON)
 
 
 mark_as_advanced(AKANTU_USE_THIRD_PARTY_MUMPS)
 if(AKANTU_USE_THIRD_PARTY_MUMPS AND AKANTU_USE_MUMPS)
   set(MUMPS_DEPENDS)
   enable_language(Fortran)
 
   include(AkantuMacros)
   include(ExternalProject)
   if(AKANTU_USE_MPI)
     set(SCALAPACK_VERSION "2.0.2")
     set(SCALAPACK_ARCHIVE "http://www.netlib.org/scalapack/scalapack-${SCALAPACK_VERSION}.tgz")
     set(SCALAPACK_ARCHIVE_HASH "MD5=2f75e600a2ba155ed9ce974a1c4b536f")
 
     ExternalProject_Add(ScaLAPACK
       PREFIX ${PROJECT_BINARY_DIR}/third-party
       URL      ${SCALAPACK_ARCHIVE}
       URL_HASH ${SCALAPACK_ARCHIVE_HASH}
       PATCH_COMMAND patch -p1 < ${PROJECT_SOURCE_DIR}/third-party/scalapack_${SCALAPACK_VERSION}.patch
       CMAKE_ARGS <SOURCE_DIR>/ScaLAPACK
       CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_C_FLAGS:STRING=-fPIC -DCMAKE_Fortran_FLAGS:STRING=-fPIC -DBUILD_SHARED_LIBS:BOOL=ON
       )
 
     set_third_party_shared_libirary_name(SCALAPACK_LIBRARIES scalapack)
     mark_as_advanced(SCALAPACK_LIBRARIES)
 
     install(FILES ${SCALAPACK_LIBRARIES}
       DESTINATION lib
       COMPONENT lib)
 
     list(APPEND MUMPS_DEPENDS ScaLAPACK)
     set(MUMPS_TYPE par)
     unset(MUMPS_PREFIX)
   else()
     set(MUMPS_TYPE seq)
     set(MUMPS_PREFIX _seq)
   endif()
 
   if(AKANTU_USE_THIRD_PARTY_SCOTCH)
     include(${PROJECT_SOURCE_DIR}/packages/90_scotch.cmake)
     list(APPEND MUMPS_DEPENDS Scotch)
   else()
     find_package(Scotch REQUIRED)
   endif()
   string(REPLACE ";" " " MUMPS_SCOTCH_LIBRARIES "${SCOTCH_LIBRARIES};${SCOTCH_LIBRARY_ESMUMPS}")
 
   find_package(BLAS REQUIRED)
   foreach(_blas_lib ${BLAS_LIBRARIES})
     if("${_blas_lib}" MATCHES ".*\\.framework")
       get_filename_component(_blas_framework "${_blas_lib}" NAME_WE)
       set(MUMPS_BLAS_LIBRARIES "${MUMPS_BLAS_LIBRARIES} -framework ${_blas_framework}")
     else()
       set(MUMPS_BLAS_LIBRARIES "${MUMPS_BLAS_LIBRARIES} ${_blas_lib}")
     endif()
   endforeach()
 
   if("${MUMPS_TYPE}" STREQUAL "seq")
     set_third_party_shared_libirary_name(MUMPS_LIBRARY_MPI mpiseq${MUMPS_PREFIX})
     mark_as_advanced(MUMPS_LIBRARY_MPI)
   else()
     set(MUMPS_LIBRARY_MPI "")
   endif()
 
   set(MUMPS_VERSION "4.10.0")
   set(MUMPS_ARCHIVE "${PROJECT_SOURCE_DIR}/third-party/MUMPS_${MUMPS_VERSION}.tar.gz")
   set(MUMPS_ARCHIVE_HASH "MD5=959e9981b606cd574f713b8422ef0d9f")
   if(NOT EXISTS ${MUMPS_ARCHIVE})
     set(MUMPS_VERSION "4.9.2")
     set(MUMPS_ARCHIVE "${PROJECT_SOURCE_DIR}/third-party/MUMPS_${MUMPS_VERSION}.tar.gz")
     set(MUMPS_ARCHIVE_HASH "MD5=d0b8f139a4acf29b76dbae69ade8ac54")
     if(NOT EXISTS ${MUMPS_ARCHIVE})
       MESSAGE(ERROR "To be able to compile MUMPS please download it from
 http://mumps.enseeiht.fr/ or http://graal.ens-lyon.fr/MUMPS
 and place it in the directory: ${PROJECT_SOURCE_DIR}/third-party
 
 Supported version for automated compilation in Akantu are 4.9.2 and 4.10.0")
     endif()
   endif()
 
   configure_file(${PROJECT_SOURCE_DIR}/third-party/MUMPS_${MUMPS_VERSION}_make.inc.cmake
     ${PROJECT_BINARY_DIR}/third-party/MUMPSmake.inc)
 
   ExternalProject_Add(MUMPS
     DEPENDS ${MUMPS_DEPENDS}
     PREFIX ${PROJECT_BINARY_DIR}/third-party
     URL ${MUMPS_ARCHIVE}
     URL_HASH ${MUMPS_ARCHIVE_HASH}
     BUILD_IN_SOURCE 1
     PATCH_COMMAND patch -p2 < ${PROJECT_SOURCE_DIR}/third-party/MUMPS_${MUMPS_VERSION}.patch
     CONFIGURE_COMMAND cmake -E copy ${PROJECT_BINARY_DIR}/third-party/MUMPSmake.inc Makefile.inc
     BUILD_COMMAND make d
     INSTALL_COMMAND prefix=<INSTALL_DIR> make install
     )
 
   set_third_party_shared_libirary_name(MUMPS_LIBRARY_DMUMPS dmumps${MUMPS_PREFIX})
   set_third_party_shared_libirary_name(MUMPS_LIBRARY_COMMON mumps_common${MUMPS_PREFIX})
   set_third_party_shared_libirary_name(MUMPS_LIBRARY_PORD pord${MUMPS_PREFIX})
   set(MUMPS_INCLUDE_DIR ${PROJECT_BINARY_DIR}/third-party/include CACHE PATH "" FORCE)
   set(MUMPS_LIBRARIES_ALL)
 
   mark_as_advanced(MUMPS_LIBRARY_COMMON MUMPS_LIBRARY_DMUMPS MUMPS_LIBRARY_PORD MUMPS_INCLUDE_DIR)
 
   list(APPEND MUMPS_LIBRARIES_ALL ${MPI_Fortran_LIBRARIES} ${MUMPS_LIBRARY_COMMON} ${MUMPS_LIBRARY_DMUMPS} ${MUMPS_LIBRARY_PORD} ${MUMPS_LIBRARY_MPI})
   set(MUMPS_LIBRARIES ${MUMPS_LIBRARIES_ALL} CACHE INTERNAL "Libraries for MUMPS" FORCE)
 
   install(FILES ${MUMPS_LIBRARIES}
     DESTINATION lib
     COMPONENT lib)
   install(DIRECTORY ${PROJECT_BINARY_DIR}/third-party/include/ DESTINATION include/mumps
     COMPONENT dev
     FILES_MATCHING PATTERN "*mumps*.h")
 
   list(APPEND AKANTU_EXTERNAL_LIBRARIES ${MUMPS_LIBRARIES})
   list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${MUMPS_INCLUDE_DIR})
 
   set(AKANTU_MUMPS_INCLUDE_DIR ${MUMPS_INCLUDE_DIR})
   set(AKANTU_MUMPS_LIBRARIES ${MUMPS_LIBRARIES})
 
   list(APPEND AKANTU_OPTION_LIST MUMPS)
 
   set(MUMPS_FOUND TRUE CACHE INTERNAL "" FORCE)
   set(AKANTU_MUMPS ON)
 
   list(APPEND AKANTU_EXTRA_TARGET_DEPENDENCIES MUMPS)
 else()
   if(AKANTU_USE_MPI)
     set(MUMPS_TYPE par)
     set(AKANTU_MUMPS_DEB_DEPEND
       libmumps-dev
       )
   else()
     set(MUMPS_TYPE seq)
     set(AKANTU_MUMPS_DEB_DEPEND
       libmumps-seq-dev
       )
   endif()
-
-  add_optional_external_package(Mumps "Add Mumps support in akantu" OFF)
-
 endif()
 
 set(AKANTU_MUMPS_TESTS
   test_sparse_matrix_profile
   test_sparse_matrix_assemble
   test_solver_mumps
   test_sparse_matrix_product
   )
 
 set(AKANTU_MUMPS_DOCUMENTATION "
 This package enables the \\href{http://mumps.enseeiht.fr/}{MUMPS} parallel direct solver for sparce matrices.
 This is necessary to solve static or implicit problems.
 
 Under Ubuntu (14.04 LTS) the installation can be performed using the commands:
 
 \\begin{command}
   > sudo apt-get install libmumps-seq-dev # for sequential
   > sudo apt-get install libmumps-dev     # for parallel
 \\end{command}
 
 Under Mac OS X the installation requires the following steps:
 \\begin{command}
   > sudo port install mumps
 \\end{command}
 
 If you activate the advanced option AKANTU\\_USE\\_THIRD\\_PARTY\\_MUMPS the make system of akantu can automatically compile MUMPS. For this you will have to download MUMPS from \\url{http://mumps.enseeiht.fr/} or \\url{http://graal.ens-lyon.fr/MUMPS} and place it in \\shellcode{<akantu source>/third-party}
 ")
diff --git a/packages/89_lapack.cmake b/packages/89_lapack.cmake
index 04db24fc1..989b890aa 100644
--- a/packages/89_lapack.cmake
+++ b/packages/89_lapack.cmake
@@ -1,41 +1,42 @@
 #===============================================================================
 # @file   89_lapack.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Fri Oct 19 2012
 # @date last modification: Thu Jun 12 2014
 #
 # @brief  package description for lapack support
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-add_optional_external_package(LAPACK "Use LAPACK for arithmetic operations" OFF LANGUAGE Fortran)
-mark_as_advanced(AKANTU_USE_LAPACK)
+package_declare(LAPACK EXTERNAL
+  DESCRIPTION "Use LAPACK for arithmetic operations"
+  EXTRA_PACKAGE_OPTIONS LANGUAGE Fortran)
 
 set(AKANTU_LAPACK_DOCUMENTATION "
 This package provides access to a LAPACK implementation.
 
 Under Ubuntu (14.04 LTS), the installation can be performed using the following command:
 \\begin{command}
   > sudo apt-get install libatlas-base-dev
 \\end{command}
 " )
diff --git a/packages/90_blackdynamite.cmake b/packages/90_blackdynamite.cmake
index 3dbd0deff..c21d59806 100644
--- a/packages/90_blackdynamite.cmake
+++ b/packages/90_blackdynamite.cmake
@@ -1,66 +1,70 @@
 #===============================================================================
 # @file   blackdynamite.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date   Tue Nov 29 15:16:35 2011
 #
 # @brief  package description for BlackDynamite support
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
-option(AKANTU_USE_BLACKDYNAMITE "Use blackdynamite library" OFF)
-mark_as_advanced(AKANTU_USE_BLACKDYNAMITE)
-find_package(Subversion)
+package_declare(BLACKDYNAMITE EXTERNAL
+  DESCRIPTION "Use blackdynamite library"
+  SYSTEM OFF)
 
-if(SUBVERSION_FOUND)
-  if(AKANTU_USE_BLACKDYNAMITE)
-    set(BLACKDYNAMITE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/third-party/blackdynamite)
-
-    if(EXISTS ${BLACKDYNAMITE_SOURCE_DIR})
-      execute_process(
-	COMMAND ${Subversion_SVN_EXECUTABLE} up ${BLACKDYNAMITE_SOURCE_DIR}
-	OUTPUT_VARIABLE _revision)
-      string(REGEX REPLACE ".*At revision ([0-9]*)\\..*" "\\1" _rev "${_revision}")
-      message(STATUS "Updating BlackDynamite: r${_rev} dynamite! dynamite!")
-    else()
-      message(STATUS "Checking out BlackDynamite: Can you digg it!")
-      execute_process(
-	COMMAND ${Subversion_SVN_EXECUTABLE} co svn+ssh://lsmssrv1.epfl.ch/space/repositories/SimulPack/BlackDynamite ${BLACKDYNAMITE_SOURCE_DIR}
-	OUTPUT_QUIET)
-    endif()
+package_get_name(BLACKDYNAMITE _pkg_name)
+package_use_system(${_pkg_name} _use_system)
+package_get_option_name(${_pkg_name} _option_name)
 
+if(NOT ${_use_system})
+  if(${_option_name})
+    find_package(Subversion)
+    if(SUBVERSION_FOUND)
+      set(BLACKDYNAMITE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/third-party/blackdynamite)
+      if(EXISTS ${BLACKDYNAMITE_SOURCE_DIR})
+	execute_process(
+	  COMMAND ${Subversion_SVN_EXECUTABLE} up ${BLACKDYNAMITE_SOURCE_DIR}
+	  OUTPUT_VARIABLE _revision)
+	string(REGEX REPLACE ".*At revision ([0-9]*)\\..*" "\\1" _rev "${_revision}")
+	message(STATUS "Updating BlackDynamite: r${_rev} dynamite! dynamite!")
+      else()
+	message(STATUS "Checking out BlackDynamite: Can you digg it!")
+	execute_process(
+	  COMMAND ${Subversion_SVN_EXECUTABLE} co svn+ssh://lsmssrv1.epfl.ch/space/repositories/SimulPack/BlackDynamite ${BLACKDYNAMITE_SOURCE_DIR}
+	  OUTPUT_QUIET)
+      endif()
 
-    set(BLACKDYNAMITE_TARGETS_EXPORT ${AKANTU_TARGETS_EXPORT})
-    add_subdirectory(third-party/blackdynamite)
+      set(BLACKDYNAMITE_TARGETS_EXPORT ${AKANTU_TARGETS_EXPORT})
+      add_subdirectory(third-party/blackdynamite)
 
-    list(APPEND AKANTU_EXTERNAL_LIBRARIES blackdynamite)
-    list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/third-party/blackdynamite/src ${BLACKDYNAMITE_EXTERNAL_INCLUDE_DIR})
+      package_set_libraries(${_pkg_name} blackdynamite)
+      package_set_include_dir(${_pkg_name}
+	${PROJECT_SOURCE_DIR}/third-party/blackdynamite/src
+	${BLACKDYNAMITE_EXTERNAL_INCLUDE_DIR})
 
-    list(APPEND AKANTU_EXPORT_LIST blackdynamite)
-    list(APPEND AKANTU_OPTION_LIST BLACKDYNAMITE)
+      list(APPEND AKANTU_EXPORT_LIST blackdynamite)
 
-    set(AKANTU_BLACKDYNAMITE_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/third-party/blackdynamite/src ${BLACKDYNAMITE_EXTERNAL_INCLUDE_DIR})
-
-    set(AKANTU_BLACKDYNAMITE ON)
-  else()
-    set(AKANTU_BLACKDYNAMITE OFF)
+      package_activate(${_pkg_name})
+    else()
+      package_deactivate(${_pkg_name})
+    endif()
   endif()
-endif()
+endif()
\ No newline at end of file
diff --git a/packages/90_blas.cmake b/packages/90_blas.cmake
index 6571f7d8a..4700fab21 100644
--- a/packages/90_blas.cmake
+++ b/packages/90_blas.cmake
@@ -1,45 +1,46 @@
 #===============================================================================
 # @file   90_blas.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Fri Oct 19 2012
 # @date last modification: Tue Jun 24 2014
 #
 # @brief  package description for blas support
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-add_optional_external_package(BLAS "Use BLAS for arithmetic operations" OFF LANGUAGE Fortran)
-mark_as_advanced(AKANTU_USE_BLAS)
+package_declare(BLAS EXTERNAL
+  DESCRIPTION "Use BLAS for arithmetic operations"
+  LANGUAGE Fortran)
 
 if(BLAS_mkl_core_LIBRARY)
   set(AKANTU_USE_BLAS_MKL)
 endif()
 
 set(AKANTU_BLAS_DOCUMENTATION "
 This package provides access to a BLAS implementation.
 
 Under Ubuntu (14.04 LTS), the installation can be performed using the following command:
 \\begin{command}
   > sudo apt-get install libatlas-base-dev
 \\end{command}
 " )
diff --git a/packages/90_cblas.cmake b/packages/90_cblas.cmake
index 4645c2d99..e69de29bb 100644
--- a/packages/90_cblas.cmake
+++ b/packages/90_cblas.cmake
@@ -1,2 +0,0 @@
-add_optional_external_package(CBLAS "Use CBLAS library" OFF)
-mark_as_advanced(AKANTU_USE_CBLAS)
diff --git a/packages/90_iohelper.cmake b/packages/90_iohelper.cmake
index 4a69ab0df..6c9a01a57 100644
--- a/packages/90_iohelper.cmake
+++ b/packages/90_iohelper.cmake
@@ -1,90 +1,92 @@
 #===============================================================================
 # @file   90_iohelper.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Tue Nov 29 2011
 # @date last modification: Tue Sep 02 2014
 #
 # @brief  package description for iohelper
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-option(AKANTU_USE_THIRD_PARTY_IOHELPER "Automatic download of the IOHelper library" ON)
-option(AKANTU_USE_IOHELPER "Add IOHelper support in akantu" ON)
+package_declare(IOHelper EXTERNAL
+  DESCRIPTION "Add IOHelper support in akantu"
+  SYSTEM OFF)
 
-mark_as_advanced(AKANTU_USE_IOHELPER)
-mark_as_advanced(AKANTU_USE_THIRD_PARTY_IOHELPER)
+package_get_name(IOHelper _pkg_name)
+package_use_system(${_pkg_name} _use_system)
+if(NOT ${_use_system})
+  package_get_option_name(${_pkg_name} _option_name)
 
-if (AKANTU_USE_THIRD_PARTY_IOHELPER AND AKANTU_USE_IOHELPER)
-  set(IOHELPER_VERSION "1.1")
-  set(IOHELPER_GIT     "https://git.epfl.ch/repo/iohelper.git")
+  if(${_option_name})
+    set(IOHELPER_VERSION "1.1")
+    set(IOHELPER_GIT     "https://git.epfl.ch/repo/iohelper.git")
 
-  include(ExternalProject)
+    include(ExternalProject)
 
-  ExternalProject_Add(IOHelper
-    PREFIX ${PROJECT_BINARY_DIR}/third-party
-    GIT_REPOSITORY ${IOHELPER_GIT}
-    CMAKE_ARGS <SOURCE_DIR>/
-    CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER:PATH=${CMAKE_CXX_COMPILER}
-    BUILD_COMMAND make
-    INSTALL_COMMAND make install
-    )
+    ExternalProject_Add(IOHelper
+      PREFIX ${PROJECT_BINARY_DIR}/third-party
+      GIT_REPOSITORY ${IOHELPER_GIT}
+      CMAKE_ARGS <SOURCE_DIR>/
+      CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER:PATH=${CMAKE_CXX_COMPILER}
+      BUILD_COMMAND make
+      INSTALL_COMMAND make install
+      )
 
     set_third_party_shared_libirary_name(IOHELPER_LIBRARIES iohelper)
-    list(APPEND AKANTU_EXTERNAL_LIBRARIES ${IOHELPER_LIBRARIES})
-    list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${PROJECT_BINARY_DIR}/third-party/include/iohelper)
+    package_set_libraries(${_pkg_name} ${IOHELPER_LIBRARIES})
+    package_set_include_dir(${_pkg_name} ${PROJECT_BINARY_DIR}/third-party/include/iohelper)
 
     list(APPEND AKANTU_EXTRA_TARGET_DEPENDENCIES IOHelper)
-    set(AKANTU_IOHELPER_INCLUDE_DIR ${PROJECT_BINARY_DIR}/third-party/include/iohelper)
-    set(AKANTU_IOHELPER ON)
-else()
-  add_optional_external_package(IOHelper "Add IOHelper support in akantu" ON)
+    package_activate(${_pkg_name})
+  else()
+    package_deactivate(${_pkg_name})
+  endif()
 endif()
 
-
-set(AKANTU_IOHELPER_FILES
+package_declare_sources(IOHelper
   io/dumper/dumper_iohelper.hh
   io/dumper/dumper_iohelper.cc
   io/dumper/dumper_paraview.hh
   io/dumper/dumper_text.cc
   io/dumper/dumper_text.hh
   io/dumper/dumper_paraview.cc
   io/dumper/dumper_homogenizing_field.hh
   io/dumper/dumper_type_traits.hh
   io/dumper/dumper_compute.hh
   io/dumper/dumper_nodal_field.hh
   io/dumper/dumper_quadrature_points_field.hh
   io/dumper/dumper_variable.hh
   io/dumper/dumper_iterator_helper.hh
   io/dumper/dumper_connectivity_field.hh
   io/dumper/dumper_padding_helper.hh
   io/dumper/dumper_elemental_field.hh
   io/dumper/dumper_element_iterator.hh
   io/dumper/dumper_material_internal_field.hh
   io/dumper/dumper_generic_elemental_field.hh
   io/dumper/dumper_generic_elemental_field_tmpl.hh
   )
 
 set(AKANTU_IOHELPER_DOCUMENTATION "
 This package activates the IOHelper facilities withing Akantu. This is mandatory if you want to be able to output Paraview files
 as well as any Dumper within Akantu.
 ")
diff --git a/packages/90_qview.cmake b/packages/90_qview.cmake
index d80ea1893..81a3b4890 100644
--- a/packages/90_qview.cmake
+++ b/packages/90_qview.cmake
@@ -1,34 +1,35 @@
 #===============================================================================
 # @file   qview.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date   Tue Nov 29 15:16:35 2011
 #
 # @brief  package description for qview
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-add_optional_external_package(QVIEW "Add QView support in akantu" OFF)
-mark_as_advanced(AKANTU_USE_QVIEW)
+package_declare(QVIEW EXTERNAL
+  DESCRIPTION "Add QView support in akantu")
+
 set(AKANTU_QVIEW_DEB_DEPEND
   qview-client
   )
diff --git a/packages/90_scotch.cmake b/packages/90_scotch.cmake
index 6dcdb6405..b840c840e 100644
--- a/packages/90_scotch.cmake
+++ b/packages/90_scotch.cmake
@@ -1,148 +1,150 @@
 #===============================================================================
 # @file   90_scotch.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Mon Nov 21 2011
 # @date last modification: Thu Jul 10 2014
 #
 # @brief  package description for scotch
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
-set(AKANTU_SCOTCH_FILES
+package_declare(Scotch EXTERNAL
+  DESCRIPTION "Add Scotch support in akantu"
+  SYSTEM ON)
+
+package_declare_sources(Scotch
   mesh_utils/mesh_partition/mesh_partition_scotch.cc
   )
 
+
 if(AKANTU_SCOTCH_ON OR AKANTU_PTSCOTCH_ON)
   set(AKANTU_PARTITIONER_ON ON)
 else()
   set(AKANTU_PARTITIONER_ON OFF)
 endif()
 
 set(AKANTU_SCOTCH_TESTS
   test_mesh_partitionate_scotch
   test_mesh_partitionate_scotch_advanced
   )
 
 
-option(AKANTU_USE_SCOTCH "Add Scotch support in akantu" OFF)
-option(AKANTU_USE_THIRD_PARTY_SCOTCH "Use the third-party Scotch instead of the one from the system" OFF)
-mark_as_advanced(AKANTU_USE_THIRD_PARTY_SCOTCH)
-
-set(SCOTCH_VERSION "5.1.12b")
-set(SCOTCH_ARCHIVE_HASH "MD5=e13b49be804755470b159d7052764dc0")
-set(SCOTCH_ARCHIVE ${PROJECT_SOURCE_DIR}/third-party/scotch_${SCOTCH_VERSION}_esmumps.tar.gz)
-if(NOT EXISTS ${SCOTCH_ARCHIVE})
-  set(SCOTCH_ARCHIVE https://gforge.inria.fr/frs/download.php/28978/scotch_${SCOTCH_VERSION}_esmumps.tar.gz)
-endif()
-
+package_get_name(Scotch _pkg_name)
+package_use_system(${_pkg_name} _use_system)
+package_get_option_name(${_pkg_name} _option_name)
 
-if(AKANTU_USE_THIRD_PARTY_SCOTCH AND AKANTU_USE_SCOTCH)
-  if(TARGET Scotch)
-    return()
+if(NOT ${_use_system})
+  set(SCOTCH_VERSION "5.1.12b")
+  set(SCOTCH_ARCHIVE_HASH "MD5=e13b49be804755470b159d7052764dc0")
+  set(SCOTCH_ARCHIVE ${PROJECT_SOURCE_DIR}/third-party/scotch_${SCOTCH_VERSION}_esmumps.tar.gz)
+  if(NOT EXISTS ${SCOTCH_ARCHIVE})
+    set(SCOTCH_ARCHIVE https://gforge.inria.fr/frs/download.php/28978/scotch_${SCOTCH_VERSION}_esmumps.tar.gz)
   endif()
 
-  find_package(BISON)
-  find_package(FLEX)
-  find_package(ZLIB)
+  if(${_option_name})
+    if(TARGET Scotch)
+      return()
+    endif()
 
-  if (AKANTU_USE_OBSOLETE_GETTIMEOFDAY)
-    set (SCOTCH_TIMMING_OPTION -DCOMMON_TIMING_OLD)
-  endif()
+    find_package(BISON)
+    find_package(FLEX)
+    find_package(ZLIB)
 
-  if(CMAKE_SIZEOF_VOID_P EQUAL 8)
-    set(SCOTCH_ARCHITECTURE -DIDXSIZE64)
-  else()
-    set(SCOTCH_ARCHITECTURE)
-  endif()
+    if (AKANTU_USE_OBSOLETE_GETTIMEOFDAY)
+      set (SCOTCH_TIMMING_OPTION -DCOMMON_TIMING_OLD)
+    endif()
 
-  set(SCOTCH_DIR ${PROJECT_BINARY_DIR}/third-party)
-  configure_file(${PROJECT_SOURCE_DIR}/third-party/scotch_${SCOTCH_VERSION}_make.inc.cmake
-    ${SCOTCH_DIR}/scotch_make.inc)
+    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+      set(SCOTCH_ARCHITECTURE -DIDXSIZE64)
+    else()
+      set(SCOTCH_ARCHITECTURE)
+    endif()
 
-  include(ExternalProject)
+    set(SCOTCH_DIR ${PROJECT_BINARY_DIR}/third-party)
+    configure_file(${PROJECT_SOURCE_DIR}/third-party/scotch_${SCOTCH_VERSION}_make.inc.cmake
+      ${SCOTCH_DIR}/scotch_make.inc)
 
-  ExternalProject_Add(Scotch
-    PREFIX ${SCOTCH_DIR}
-    URL ${SCOTCH_ARCHIVE}
-    URL_HASH ${SCOTCH_ARCHIVE_HASH}
-    TLS_VERIFY FALSE
-    PATCH_COMMAND patch -p1 < ${PROJECT_SOURCE_DIR}/third-party/scotch_${SCOTCH_VERSION}.patch
-    CONFIGURE_COMMAND cmake -E copy ${SCOTCH_DIR}/scotch_make.inc src/Makefile.inc
-    BUILD_IN_SOURCE 1
-    BUILD_COMMAND make -C src
-    INSTALL_COMMAND prefix=<INSTALL_DIR> make -C src install
-    )
+    include(ExternalProject)
 
-  set_third_party_shared_libirary_name(SCOTCH_LIBRARY scotch)
-  set_third_party_shared_libirary_name(SCOTCH_LIBRARY_ERR     scotcherr)
-  set_third_party_shared_libirary_name(SCOTCH_LIBRARY_ERREXIT scotcherrexit)
-  set_third_party_shared_libirary_name(SCOTCH_LIBRARY_ESMUMPS esmumps)
+    ExternalProject_Add(Scotch
+      PREFIX ${SCOTCH_DIR}
+      URL ${SCOTCH_ARCHIVE}
+      URL_HASH ${SCOTCH_ARCHIVE_HASH}
+      TLS_VERIFY FALSE
+      PATCH_COMMAND patch -p1 < ${PROJECT_SOURCE_DIR}/third-party/scotch_${SCOTCH_VERSION}.patch
+      CONFIGURE_COMMAND cmake -E copy ${SCOTCH_DIR}/scotch_make.inc src/Makefile.inc
+      BUILD_IN_SOURCE 1
+      BUILD_COMMAND make -C src
+      INSTALL_COMMAND prefix=<INSTALL_DIR> make -C src install
+      )
 
-  set(SCOTCH_INCLUDE_DIR     ${SCOTCH_DIR}/include CACHE PATH "" FORCE)
+    set_third_party_shared_libirary_name(SCOTCH_LIBRARY scotch)
+    set_third_party_shared_libirary_name(SCOTCH_LIBRARY_ERR     scotcherr)
+    set_third_party_shared_libirary_name(SCOTCH_LIBRARY_ERREXIT scotcherrexit)
+    set_third_party_shared_libirary_name(SCOTCH_LIBRARY_ESMUMPS esmumps)
 
-  mark_as_advanced(SCOTCH_LIBRARY SCOTCH_LIBRARY_ERR SCOTCH_LIBRARY_ERREXIT SCOTCH_LIBRARY_ESMUMPS
-    SCOTCH_INCLUDE_DIR)
+    set(SCOTCH_INCLUDE_DIR ${SCOTCH_DIR}/include CACHE PATH "" FORCE)
 
-  set(SCOTCH_LIBRARIES_ALL ${SCOTCH_LIBRARY} ${SCOTCH_LIBRARY_ERR})
-  set(SCOTCH_LIBRARIES ${SCOTCH_LIBRARIES_ALL} CACHE INTERNAL "Libraries for scotch" FORCE)
+    mark_as_advanced(SCOTCH_LIBRARY SCOTCH_LIBRARY_ERR SCOTCH_LIBRARY_ERREXIT SCOTCH_LIBRARY_ESMUMPS
+      SCOTCH_INCLUDE_DIR)
 
-  list(APPEND AKANTU_EXTERNAL_LIBRARIES ${SCOTCH_LIBRARIES})
-  list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${SCOTCH_INCLUDE_DIR})
+    set(SCOTCH_LIBRARIES_ALL ${SCOTCH_LIBRARY} ${SCOTCH_LIBRARY_ERR})
+    set(SCOTCH_LIBRARIES ${SCOTCH_LIBRARIES_ALL} CACHE INTERNAL "Libraries for scotch" FORCE)
 
-  set(AKANTU_SCOTCH_INCLUDE_DIR ${SCOTCH_INCLUDE_DIR})
-  set(AKANTU_SCOTCH_LIBRARIES ${SCOTCH_LIBRARIES})
+    package_set_libraries(${_pkg_name}   ${SCOTCH_LIBRARIRES})
+    package_set_include_dir(${_pkg_name} ${SCOTCH_INCLUDE_DIR})
 
-  list(APPEND AKANTU_OPTION_LIST SCOTCH)
-  set(SCOTCH_FOUND TRUE CACHE INTERNAL "" FORCE)
-  set(AKANTU_SCOTCH ON)
+    list(APPEND AKANTU_EXTRA_TARGET_DEPENDENCIES Scotch)
 
-  list(APPEND AKANTU_EXTRA_TARGET_DEPENDENCIES Scotch)
-else()
-  add_optional_external_package(Scotch "Add Scotch support in akantu" OFF)
-
-  if(SCOTCH_INCLUDE_DIR)
-    file(STRINGS ${SCOTCH_INCLUDE_DIR}/scotch.h SCOTCH_INCLUDE_CONTENT)
-    string(REGEX MATCH "_cplusplus" _match ${SCOTCH_INCLUDE_CONTENT})
-    if(_match)
-      set(AKANTU_SCOTCH_NO_EXTERN ON)
-      list(APPEND AKANTU_DEFINITIONS AKANTU_SCOTCH_NO_EXTERN)
-    else()
-      set(AKANTU_SCOTCH_NO_EXTERN OFF)
-    endif()
+    package_activate(${_pkg_name})
+  else()
+    package_deactivate(${_pkg_name})
   endif()
 endif()
 
+if(SCOTCH_INCLUDE_DIR)
+  file(STRINGS ${SCOTCH_INCLUDE_DIR}/scotch.h SCOTCH_INCLUDE_CONTENT)
+  string(REGEX MATCH "_cplusplus" _match ${SCOTCH_INCLUDE_CONTENT})
+  if(_match)
+    set(AKANTU_SCOTCH_NO_EXTERN ON)
+    list(APPEND AKANTU_DEFINITIONS AKANTU_SCOTCH_NO_EXTERN)
+  else()
+    set(AKANTU_SCOTCH_NO_EXTERN OFF)
+  endif()
+endif()
+
+
 set(AKANTU_SCOTCH_DOCUMENTATION "
 This package enables the use the \\href{http://www.labri.fr/perso/pelegrin/scotch/}{Scotch} library in
 order to perform a graph partitioning leading to the domain
 decomposition used within \\akantu
 
 Under Ubuntu (14.04 LTS) the installation can be performed using the commands:
 \\begin{command}
   > sudo apt-get install libscotch-dev
 \\end{command}
 
 If you activate the advanced option AKANTU\\_USE\\_THIRD\\_PARTY\\_SCOTCH the make system of akantu can automatically compile Scotch.
 
 If the automated download fails due to a SSL access not supported by your version of CMake please download the file \\href{https://gforge.inria.fr/frs/download.php/28978/scotch\\_${SCOTCH_VERSION}\\_esmumps.tar.gz}{scotch\\_${SCOTCH_VERSION}\\_esmumps.tar.gz}  and then place it in the directory \\shellcode{<akantu source>/third-party}
 " )
diff --git a/packages/debug_tools.cmake b/packages/debug_tools.cmake
index 67a9aaf8b..29f423b99 100644
--- a/packages/debug_tools.cmake
+++ b/packages/debug_tools.cmake
@@ -1,32 +1,33 @@
 #===============================================================================
 # @file   debug_tools.cmake
 #
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @brief  some usefull tools to debug
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
-option(AKANTU_DEBUG_TOOLS "Compiles akantu with the advanced debug tools activated (/!\ can slow down the code)" OFF)
-mark_as_advanced(AKANTU_DEBUG_TOOLS)
+package_declare(debug_tools ADVANCED
+  DESCRIPTION "Compiles akantu with the advanced debug tools activated (/!\ can slow down the code)")
 
-set(AKANTU_DEBUG_TOOLS_FILES
+
+package_declare_sources(debug_tools
   common/aka_debug_tools.hh
   )
\ No newline at end of file
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b9ede9f2e..57ca060f8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,159 +1,178 @@
 #===============================================================================
 # @file   CMakeLists.txt
 #
 # @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
 # @author Nicolas Richart <nicolas.richart@epfl.ch>
 #
 # @date creation: Mon Nov 28 2011
 # @date last modification: Tue Sep 16 2014
 #
 # @brief  CMake file for the library
 #
 # @section LICENSE
 #
 # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
 # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
 #
 # Akantu is free  software: you can redistribute it and/or  modify it under the
 # terms  of the  GNU Lesser  General Public  License as  published by  the Free
 # Software Foundation, either version 3 of the License, or (at your option) any
 # later version.
 #
 # Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
 # details.
 #
 # You should  have received  a copy  of the GNU  Lesser General  Public License
 # along with Akantu. If not, see <http://www.gnu.org/licenses/>.
 #
 #===============================================================================
 
 #===============================================================================
 # Package Management
 #===============================================================================
-generate_source_list_from_packages(${CMAKE_CURRENT_BINARY_DIR}
+package_get_source_files(
   AKANTU_LIBRARY_SRCS
-  AKANTU_LIBRARY_INLINE_HDRS
-  AKANTU_LIBRARY_HDRS
-  AKANTU_LIBRARY_INCLUDE_DIRS)
+  AKANTU_LIBRARY_PUBLIC_HDRS
+  AKANTU_LIBRARY_PRIVATE_HDRS
+  )
+
+package_get_include_directories(
+  AKANTU_LIBRARY_INCLUDE_DIRS
+  )
+
+package_get_external_informations(
+  AKANTU_EXTERNAL_LIB_INCLUDE_DIR
+  AKANTU_EXTERNAL_LIB_LIBRARIES
+)
 
 #===========================================================================
 # header for blas/lapack (any other fortran libraries)
 #===========================================================================
-if(AKANTU_LAPACK OR AKANTU_BLAS)
+package_get_name(BLAS _blas_pkg_name)
+package_get_name(LAPACK _lapack_pkg_name)
+
+package_is_activated(${_blas_pkg_name} _blas_activated)
+package_is_activated(${_lapack_pkg_name} _lapack_activated)
+
+if(_blas_activated OR _lapack_activated)
+  if(CMAKE_Fortran_COMPILER)
+    # ugly hack
+    set(CMAKE_Fortran_COMPILER_LOADED TRUE)
+  endif()
+
   include(FortranCInterface)
   FortranCInterface_HEADER(
     ${CMAKE_CURRENT_BINARY_DIR}/aka_fortran_mangling.hh
     MACRO_NAMESPACE "AKA_FC_")
   mark_as_advanced(CDEFS)
-  list(APPEND AKANTU_LIBRARY_HDRS ${CMAKE_CURRENT_BINARY_DIR}/aka_fortran_mangling.hh)
+  list(APPEND AKANTU_LIBRARY_PUBLIC_HDRS ${CMAKE_CURRENT_BINARY_DIR}/aka_fortran_mangling.hh)
 endif()
 
 configure_file(common/aka_config.hh.in "${CMAKE_CURRENT_BINARY_DIR}/aka_config.hh" @ONLY)
-list(APPEND AKANTU_LIBRARY_HDRS ${CMAKE_CURRENT_BINARY_DIR}/aka_config.hh)
+list(APPEND AKANTU_LIBRARY_PUBLIC_HDRS ${CMAKE_CURRENT_BINARY_DIR}/aka_config.hh)
 
 #===========================================================================
 # header precompilation
 #===========================================================================
 set(AKANTU_COMMON_HDR_TO_PRECOMPILE
   common/aka_vector.hh
   common/aka_math.hh
   common/aka_types.hh
   fem/element_class.hh
   )
 
 set(AKANTU_PRECOMPILE_HDR_INCLUDE_DIRS
   ${CMAKE_CURRENT_BINARY_DIR}/common/
   ${CMAKE_CURRENT_BINARY_DIR}/fem/
   )
 
 set(AKANTU_INCLUDE_DIRS
   ${CMAKE_CURRENT_BINARY_DIR} ${AKANTU_LIBRARY_INCLUDE_DIRS} ${AKANTU_PRECOMPILE_HDR_INCLUDE_DIRS}
   CACHE INTERNAL "Internal include directories to link with Akantu as a subproject")
 
 include_directories(${AKANTU_INCLUDE_DIRS} ${AKANTU_EXTERNAL_LIB_INCLUDE_DIR})
 
 function(generate_material_list)
   message(STATUS "Determining the list of recognized materials...")
 
   set(_include_dirs ${AKANTU_INCLUDE_DIRS} ${AKANTU_EXTERNAL_LIB_INCLUDE_DIR})
 
   try_run(_material_list_run _material_list_compile
     ${CMAKE_BINARY_DIR}
     ${PROJECT_SOURCE_DIR}/cmake/material_lister.cc
     CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${_include_dirs}"
     COMPILE_DEFINITIONS "-DAKANTU_CMAKE_LIST_MATERIALS"
     COMPILE_OUTPUT_VARIABLE _compile_results
     RUN_OUTPUT_VARIABLE _result_material_list)
 
   if(_material_list_compile AND "${_material_list_run}" EQUAL 0)
     message(STATUS "Materials included in Akantu:")
     string(REPLACE "\n" ";" _material_list "${_result_material_list}")
     foreach(_mat ${_material_list})
       string(REPLACE ":" ";" _mat_key "${_mat}")
       list(GET _mat_key 0 _key)
       list(GET _mat_key 1 _class)
       list(LENGTH _mat_key _l)
 
       if("${_l}" GREATER 2)
 	list(REMOVE_AT _mat_key 0 1)
 	set(_opt " -- options: [")
 	foreach(_o ${_mat_key})
 	  set(_opt "${_opt} ${_o}")
 	endforeach()
 	set(_opt "${_opt} ]")
       else()
 	set(_opt "")
       endif()
 
       message(STATUS "   ${_class} -- key: ${_key}${_opt}")
     endforeach()
   else()
     message(STATUS "Could not determine the list of materials.")
     message("${_compile_results}")
   endif()
 endfunction()
 
 generate_material_list()
 
 if(CMAKE_COMPILER_IS_GNUCXX)
   include(PCHgcc)
   foreach(_header ${AKANTU_COMMON_HDR_TO_PRECOMPILE})
     add_pch_rule(${_header} AKANTU_LIBRARY_SRCS)
   endforeach()
 elseif(CMAKE_COMPILER_IS_GNUCXX)
 endif()
 
 #===============================================================================
 # Library generation
 #===============================================================================
 add_library(akantu ${AKANTU_LIBRARY_SRCS})
 target_link_libraries(akantu ${AKANTU_EXTERNAL_LIBRARIES})
 
 if(AKANTU_EXTRA_TARGET_DEPENDENCIES)
   add_dependencies(akantu ${AKANTU_EXTRA_TARGET_DEPENDENCIES})
 endif()
 
-list(APPEND AKANTU_PUBLIC_HDRS ${AKANTU_LIBRARY_HDRS} ${AKANTU_LIBRARY_INLINE_HDRS})
 set_target_properties(akantu PROPERTIES ${AKANTU_LIBRARY_PROPERTIES})
-set_target_properties(akantu PROPERTIES PUBLIC_HEADER "${AKANTU_PUBLIC_HDRS}")
+set_target_properties(akantu PROPERTIES PUBLIC_HEADER "${AKANTU_LIBRARY_PUBLIC_HDRS}")
 
 list(APPEND AKANTU_EXPORT_LIST akantu)
 
 install(TARGETS akantu
   EXPORT ${AKANTU_TARGETS_EXPORT}
   LIBRARY DESTINATION lib COMPONENT lib
   ARCHIVE DESTINATION lib COMPONENT lib
   PUBLIC_HEADER DESTINATION include/akantu/ COMPONENT dev
   )
 
 if("${AKANTU_TARGETS_EXPORT}" STREQUAL "AkantuLibraryDepends")
   install(EXPORT AkantuLibraryDepends DESTINATION  lib/akantu
     COMPONENT dev)
 endif()
 
 #Export for build tree
 export(TARGETS ${AKANTU_EXPORT_LIST}
   FILE "${CMAKE_BINARY_DIR}/AkantuLibraryDepends.cmake")
 export(PACKAGE Akantu)
diff --git a/src/solver/static_solver.cc b/src/solver/static_solver.cc
index be55b89b2..5c27cf1f9 100644
--- a/src/solver/static_solver.cc
+++ b/src/solver/static_solver.cc
@@ -1,102 +1,100 @@
 /**
  * @file   static_solver.cc
  * @author Aurelia Cuba Ramos <aurelia.cubaramos@epfl.ch>
  * @date   Wed Jul 30 15:35:01 2014
  *
  * @brief  implementation of the static solver
  *
  * @section LICENSE
  *
  * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
  * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
  *
  * Akantu is free  software: you can redistribute it and/or  modify it under the
  * terms  of the  GNU Lesser  General Public  License as  published by  the Free
  * Software Foundation, either version 3 of the License, or (at your option) any
  * later version.
  *
  * Akantu is  distributed in the  hope that it  will be useful, but  WITHOUT ANY
  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  * A  PARTICULAR PURPOSE. See  the GNU  Lesser General  Public License  for more
  * details.
  *
  * You should  have received  a copy  of the GNU  Lesser General  Public License
  * along with Akantu. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 /* -------------------------------------------------------------------------- */
 #include "static_solver.hh"
 /* -------------------------------------------------------------------------- */
 #ifdef AKANTU_USE_PETSC
 #include <petscsys.h>
 #endif
 
 /* -------------------------------------------------------------------------- */
 
 __BEGIN_AKANTU__
 
 /* -------------------------------------------------------------------------- */
 StaticSolver::~StaticSolver() {
   --this->nb_references;
   if(this->nb_references == 0)
     delete this->static_solver;
 }
 
 /* -------------------------------------------------------------------------- */
 StaticSolver & StaticSolver::getStaticSolver() {
   if(nb_references == 0)
     static_solver = new StaticSolver();
-  
   ++nb_references;
-  
   return *static_solver;
 }
 
 #ifdef AKANTU_USE_PETSC
 #if PETSC_VERSION_MAJOR >= 3 && PETSC_VERSION_MINOR >= 5
 static PetscErrorCode PETScErrorHandler(MPI_Comm,
 					int line, const char * dir, const char *file,
 					PetscErrorCode number,
 					PetscErrorType type,
 					const char *message,
 					void *) {
   AKANTU_DEBUG_ERROR("An error occured in PETSc in file \"" << file << ":" << line << "\" - PetscErrorCode "<< number << " - \""<< message << "\"");
 }
 #else
 static PetscErrorCode PETScErrorHandler(MPI_Comm,
 					int line, const char * func, const char * dir, const char *file,
 					PetscErrorCode number,
 					PetscErrorType type,
 					const char *message,
 					void *) {
   AKANTU_DEBUG_ERROR("An error occured in PETSc in file \"" << file << ":" << line << "\" - PetscErrorCode "<< number << " - \""<< message << "\"");
 }
 #endif
 #endif
 
 /* -------------------------------------------------------------------------- */
 void StaticSolver::initialize(int & argc, char ** & argv) {
   AKANTU_DEBUG_ASSERT(this->is_initialized != true, "The static solver has already been initialized");
 #ifdef AKANTU_USE_PETSC
     PetscErrorCode petsc_error = PetscInitialize(&argc, &argv, NULL, NULL);
     if(petsc_error != 0) {
       AKANTU_DEBUG_ERROR("An error occured while initializing Petsc (PetscErrorCode "<< petsc_error << ")");
     }
     PetscPushErrorHandler(PETScErrorHandler, NULL);
 #endif
 
     this->is_initialized = true;
   }
 
 /* -------------------------------------------------------------------------- */
 void StaticSolver::finalize() {
   AKANTU_DEBUG_ASSERT(this->is_initialized == true, "The static solver has not been initialized");
 #ifdef AKANTU_USE_PETSC
   PetscFinalize();
 #endif
 
   this->is_initialized = false;
 }
 
 __END_AKANTU__