#                                               -*- cmake -*-
#
#  CMakeLists.txt
#
#  (C) Copyright 2005-2012 EDF-EADS-Phimeca
#
#  This library 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 2.1 of the License.
#
#  This library 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 this library; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
#
#  @author: $LastChangedBy: dutka $
#  @date:   $LastChangedDate: 2010-02-04 16:44:49 +0100 (Thu, 04 Feb 2010) $
#  Id:      $Id: Makefile.am 1473 2010-02-04 15:44:49Z dutka $
#

#project ( OpenTURNSLib CXX C Fortran )

# Recurse in subdirectories
add_subdirectory ( include )
add_subdirectory ( src )
add_subdirectory ( etc )

# Build the OpenTURNSConfig.cmake file
get_target_property ( OPENTURNS_LIBRARY_LOC OT LOCATION )
get_filename_component ( OPENTURNS_INSTALL_LIBRARY ${OPENTURNS_LIBRARY_LOC} NAME )
set ( OPENTURNS_LIBRARY_DIRS   ${LIBRARY_PATH} )
set ( OPENTURNS_LIBRARY        ${LIBRARY_PATH}/${OPENTURNS_INSTALL_LIBRARY} )
set ( OPENTURNS_INCLUDE        ${INCLUDE_PATH} )
set ( OPENTURNS_DEFINITIONS    "" )
set ( OPENTURNS_ROOT_DIR       ${INSTALL_PATH} )
set ( OPENTURNS_VERSION_STRING ${PACKAGE_VERSION} )
set ( OPENTURNS_VERSION_MAJOR  ${CPACK_PACKAGE_VERSION_MAJOR} )
set ( OPENTURNS_VERSION_MINOR  ${CPACK_PACKAGE_VERSION_MINOR} )
set ( OPENTURNS_VERSION_PATCH  ${CPACK_PACKAGE_VERSION_PATCH} )
set ( OPENTURNS_USE_FILE       ${LIBRARY_PATH}/OpenTURNSUse.cmake )

configure_file ( ${PROJECT_SOURCE_DIR}/lib/OpenTURNSConfig.cmake.in
                 ${PROJECT_BINARY_DIR}/lib/OpenTURNSConfig.cmake
		 @ONLY
               )
install ( FILES ${PROJECT_SOURCE_DIR}/lib/OpenTURNSUse.cmake
                ${PROJECT_BINARY_DIR}/lib/OpenTURNSConfig.cmake
          DESTINATION ${OPENTURNS_LIBRARY_PATH}
        )

install ( FILES AUTHORS
                COPYING
		COPYING.MuParser
		COPYING.cobyla
		COPYING.dsfmt
		COPYING.lapack
		COPYING.tnc
		COPYING.kissfft
		ChangeLog
		INSTALL
		NEWS
		README
		TODO
	  DESTINATION ${OPENTURNS_DOC_PATH}
        )

# Recurse in subdirectories : Test should be run after src (for  target OT to be built)
add_subdirectory ( test )
