#**********************************************************************
#* Copyright (c) 2009 David Carter <dcarter@davidcarter.ca> and others.
#* All rights reserved.   This program and the accompanying materials
#* are made available under the terms of the Eclipse Public License v1.0
#* which accompanies this distribution, and is available at
#* http://www.eclipse.org/legal/epl-v10.html
#*
#* Contributors:
#* David Carter - Initial API and implementation
#**********************************************************************

# The name of our project is "QPP". CMakeLists files in this project can
# refer to the root source directory of the project as ${QPP_SOURCE_DIR} and
# to the root binary directory of the project as ${QPP_BINARY_DIR}.
cmake_minimum_required (VERSION 2.6)
project (QPP)

# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
include (MacroLibrary)

################# Disallow in-source build #################

macro_ensure_out_of_source_build("QPP requires an out of source build. Please create a separate build directory and run 'cmake path_to_qpp [options]' there.")

#########################################################################

INCLUDE(InstallRequiredSystemLibraries)

SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A C++ Queuing model library")
SET(CPACK_PACKAGE_VENDOR "http://www.davidcarter.ca")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "0")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
IF(WIN32 AND NOT UNIX)
  # There is a bug in NSI that does not handle full unix paths properly. Make
  # sure there is at least one set of four (4) backlasshes.
  ##SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
  ##SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe")
  SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} QPP C++ Queuing Model Library")
  SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\qpp.davidcarter.ca")
  SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.davidcarter.ca")
  SET(CPACK_NSIS_CONTACT "dcarter@davidcarter.ca")
  SET(CPACK_NSIS_MODIFY_PATH ON)
ELSE(WIN32 AND NOT UNIX)
  ##SET(CPACK_STRIP_FILES "bin/MyExecutable")
  SET(CPACK_SOURCE_STRIP_FILES "")
ENDIF(WIN32 AND NOT UNIX)
##SET(CPACK_PACKAGE_EXECUTABLES "MyExecutable" "My Executable")
SET(CPACK_SOURCE_IGNORE_FILES
"/_CPack_Packages/;/CVS/;/\\\\.svn/;\\\\.swp$;\\\\.#;/#;.*~;cscope.*;.*\\\\.tar\\\\.gz;.*\\\\.tar\\\\.bz2;.*\\\\.tar\\\\.Z")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "qpp-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
INCLUDE(CPack)

# Allow the developer to select if Dynamic or Static libraries are built
OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON)

# Set the LIB_TYPE variable to STATIC
SET (LIB_TYPE STATIC)
IF (BUILD_SHARED_LIBS)
  # User wants to build Dynamic Libraries, so change the LIB_TYPE variable to CMake keyword 'SHARED'
  SET (LIB_TYPE SHARED)
ENDIF (BUILD_SHARED_LIBS)


# Recurse into the subdirectories.
add_subdirectory (doc)
add_subdirectory (man)
add_subdirectory (include)
add_subdirectory (src)
add_subdirectory (test)
