SET (IPOPT_FOUND FALSE)


UNSET( IPOPT_INCLUDE_DIR              CACHE)   
UNSET( IPOPT_LIBRARY                  CACHE)    

IF(CUSTOM_IPOPT_PATH)

  FIND_PATH (IPOPT_INCLUDE_DIR coin/IpTNLP.hpp
    PATHS 
    ${CUSTOM_IPOPT_PATH}/include
    NO_DEFAULT_PATH
    )

  FIND_LIBRARY (IPOPT_LIBRARY ipopt
    PATHS
    ${CUSTOM_IPOPT_PATH}/lib
    NO_DEFAULT_PATH
    )
ENDIF(CUSTOM_IPOPT_PATH)

IF (IPOPT_INCLUDE_DIR AND IPOPT_LIBRARY)
  SET (IPOPT_FOUND TRUE)
ELSE(IPOPT_INCLUDE_DIR AND IPOPT_LIBRARY)
  IF(IPOPT_FIND_REQUIRED)
    MESSAGE (SEND_ERROR " Could not find IPOPT.")
    MESSAGE (SEND_ERROR " Try setting CUSTOM_IPOPT_PATH in FindIPOPT.cmake force CMake to use the desired directory.")
  ELSE(IPOPT_FIND_REQUIRED)
    MESSAGE (STATUS " Could not find IPOPT.")
    MESSAGE (STATUS " Try setting CUSTOM_IPOPT_PATH in FindIPOPT.cmake force CMake to use the desired directory.")
  ENDIF(IPOPT_FIND_REQUIRED)
ENDIF (IPOPT_INCLUDE_DIR AND IPOPT_LIBRARY)

IF (IPOPT_FOUND)
   IF (NOT IPOPT_FIND_QUIETLY)
      MESSAGE(STATUS "Found IPOPT: ${IPOPT_LIBRARY}")
   ENDIF (NOT IPOPT_FIND_QUIETLY)

ENDIF (IPOPT_FOUND)

MARK_AS_ADVANCED (
  IPOPT_INCLUDE_DIR
  IPOPT_LIBRARY
  )
