message: Modifed FindParMoonolith.cmake for supporting previously installed moonolith codes and use automatic installation as a fallback.
diff: cmake_minimum_required(VERSION 2.8)
  +
  +if(MOONOLITH_DIR OR DEFINED ENV{MOONOLITH_DIR})
  +
  + find_path(MOONOLITH_INSTALLATION_PATH
  + NAME config/moonolith_config.cmake
  + HINTS ${MOONOLITH_DIR}
  + $ENV{MOONOLITH_DIR}
  + )
  +
  +
  + if(MOONOLITH_INSTALLATION_PATH)
  + message(STATUS "Found moonolith installation at ${MOONOLITH_INSTALLATION_PATH}")
  + include(${MOONOLITH_INSTALLATION_PATH}/config/moonolith_config.cmake)
  + include(FindPackageHandleStandardArgs)
  +
  + find_package_handle_standard_args(MOONOLITH
  + REQUIRED_VARS MOONOLITH_LIBRARIES MOONOLITH_INCLUDES
  + )
  +
  + mark_as_advanced(MOONOLITH_INCLUDES MOONOLITH_LIBRARIES)
  +
  + if(MOONOLITH_FOUND)
  + add_custom_target(par_moonolith)
  + endif()
  + else()
  +
  + endif()
  +
  +endif()
  +
  +
  +if(NOT MOONOLITH_FOUND)
  + #Automatically download
  include(ExternalProject)
  set(STAGE_DIR "${CMAKE_BINARY_DIR}/stage")
  @@ -6,10 +39,10 @@ set(MOONOLITH_URL https://zulianp@bitbucket.org/zulianp/par_moonolith.git)
  set(MOONOLITH_SOURCE_DIR ${STAGE_DIR}/par_moonolith)
  set(MOONOLITH_BIN_DIR ${STAGE_DIR}/par_moonolith/bin)
  -if(DEFINED ENV{MOONOLITH_INSTALL_PREFIX})
  - set(MOONOLITH_INSTALL_DIR $ENV{MOONOLITH_INSTALL_PREFIX})
  -elseif(MOONOLITH_INSTALL_PREFIX)
  + if(MOONOLITH_INSTALL_PREFIX)
  set(MOONOLITH_INSTALL_DIR ${MOONOLITH_INSTALL_PREFIX})
  + elseif(DEFINED ENV{MOONOLITH_INSTALL_PREFIX})
  + set(MOONOLITH_INSTALL_DIR $ENV{MOONOLITH_INSTALL_PREFIX})
  else()
  set(MOONOLITH_INSTALL_DIR ${CMAKE_BINARY_DIR}/external)
  message(STATUS "Moonolith will be installed in ${MOONOLITH_INSTALL_DIR}.\nIf you want a different location set MOONOLITH_INSTALL_PREFIX")
  @@ -25,6 +58,8 @@ list(APPEND MOONOLITH_CMAKE_ARGS
  "-DENABLE_MOONOLITH_PROFILER=${ENABLE_MOONOLITH_PROFILER}"
  )
  + message(STATUS "${MOONOLITH_CMAKE_ARGS}")
  +
  ExternalProject_Add(
  par_moonolith
  UPDATE_COMMAND "" #FIXME
  @@ -54,6 +89,6 @@ list(APPEND MOONOLITH_LIBRARIES
  "-lpar_moonolith_utils"
  )
  -
  set(MOONOLITH_FOUND TRUE)
  +endif()
  