adapt CMakeLists to feel++
up feelpp/feelpp#407
 - fix cmake build for Feel++
 - define NLOPT_MAJOR_VERSION NLOPT_MINOR_VERSION
up feelpp/feelpp#407
 - use std::function intead of pointer function, it allows us to use much more
 powerful mechanisms to be used for the objective function and precondition
 function such as lambda, functors, function objects...
up feelpp/feelpp#407
 - use new/delete instead of malloc/free otherwise we get segfault when working
 with std::function objects