Using BuildDakotaTemplate.cmake Script

The following CMake variables represent the minimum set of variables that are required to allow Dakota to:

  • find all prerequisite third party libraries (TPLs)
  • configure compiler and MPI options
  • set Dakota install path


  1. Download Dakota source code and untar/unzip the tar archive files.
  2. Create a build directory.
  3. Copy dakota-src/cmake/BuildDakotaTemplate.cmake into build directory.
  4. Uncomment CMake variables below ONLY for values you need to change for your platform. Edit variables as needed.
  5. Run CMake with script file.

CMake Variables

Set BLAS, LAPACK library paths ONLY if in non-standard locations

set( BLAS_LIBS "/usr/lib64"
    CACHE FILEPATH "Use non-standard BLAS library path" FORCE )
set( LAPACK_LIBS "/usr/lib64"
    CACHE FILEPATH "Use non-standard BLAS library path" FORCE )

Set additional compiler options.

Uncomment and replace <flag> with actual compiler flag, e.g. -xxe4.2

set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} &amp;amp;amp;amp;amp;lt;flag&amp;amp;amp;amp;amp;gt;" 
    CACHE STRING "C Flags my platform" ) 
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} &amp;amp;amp;amp;amp;lt;flag&amp;amp;amp;amp;amp;gt;" 
    CACHE STRING "CXX Flags for my platform" ) 
set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} &amp;amp;amp;amp;amp;lt;flag&amp;amp;amp;amp;amp;gt;" 
    CACHE STRING "Fortran Flags for my platform" )

Set MPI options

Recommended practice is to set DAKOTA_HAVE_MPI and set MPI_CXX_COMPILER to a compiler wrapper.

     CACHE BOOL "Build with MPI enabled" FORCE)
set( MPI_CXX_COMPILER "path/to/mpicxx"
     CACHE FILEPATH "Use MPI compiler wrapper" FORCE)

Set Boost path

You will need to set the following variables iff CMake cannot find your installed version of Boost or if you have a custom Boost install location.

    CACHE PATH "Use non-standard Boost install" FORCE)
     CACHE BOOL "Supress search paths other than BOOST_ROOT" FORCE)

Set Trilinos path for Custom Trilinos Installation

You will need to set the following variable if you want have a custom Trilinos install location. If not set, the Trilinos package, teuchos, will be build during the Dakota build.

set( Trilinos_DIR
     CACHE PATH "Path to installed Trilinos" FORCE )

Customize DAKOTA

     CACHE PATH "Path to Dakota installation" )