提交 c881d4af 编写于 作者: J Julien Schueller 提交者: Steven G. Johnson

CMake: Add NLOPT_VERSION in config (#262)

* CMake: Add NLOPT_VERSION in config

* Fix few more warnings
上级 5351d0fb
......@@ -6,6 +6,8 @@ endif ()
# Tell the user project where to find our headers and libraries
set (NLOPT_VERSION "@NLOPT_VERSION_STRING@")
set (NLOPT_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/@RELATIVE_NLOPT_INCLUDE_DIRS@")
set (NLOPT_LIBRARY_DIRS "${CMAKE_CURRENT_LIST_DIR}/@RELATIVE_NLOPT_LIB_DIR@")
......
......@@ -39,7 +39,7 @@
#ifndef HAVE_COPYSIGN
/* not quite right for y == -0, but good enough for us */
# define copysign(x, y) ((y) < 0 ? -fabs(x) : fabs(x))
#elif __STDC_VERSION__ < 199901 && !defined(__cplusplus)
#elif !defined(__cplusplus) && __STDC_VERSION__ < 199901
extern double copysign(double x, double y); /* may not be declared in C89 */
#endif
......
......@@ -172,16 +172,18 @@ static int qsort_cmp_wrap(const void *a, const void *b, void *thunk)
qsort_wrapper *wrap = (qsort_wrapper *) thunk;
return (*wrap->compar)(wrap->thunk, a, b);
}
extern void qsort_r(void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *, void *),
void *arg);
#endif
void nlopt_qsort_r(void *base_, size_t nmemb, size_t size, void *thunk, cmp_t* compar)
{
#if defined(HAVE_QSORT_R) && (defined(__APPLE__) || defined(__FreeBSD__))
qsort_r(base_, nmemb, size, thunk, compar);
#elif defined(HAVE_QSORT_R) && defined(__linux__)
extern void qsort_r(void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *, void *),
void *arg);
qsort_wrapper wrapper;
wrapper.compar = compar;
wrapper.thunk = thunk;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册