CMAKE_OPTIONS+=" -DPYTHON_EXECUTABLE=${PYTHONBIN}"
CMAKE_OPTIONS+=" -DSWIG_EXECUTABLE=${SWIG_ROOT_DIR}/bin/swig"
-if [ "${TBB_ROOT_DIR}" != "/usr" ]
-then
+if [ -n "$TBB_ROOT_DIR" ] && [ "${TBB_ROOT_DIR}" != "/usr" ]; then
CMAKE_OPTIONS+=" -DTBB_ROOT_DIR=${TBB_ROOT_DIR}"
fi
### libxml2 settings
-if [ "${LIBXML2_ROOT_DIR}" != "/usr" ]
-then
+if [ -n "$LIBXML2_ROOT_DIR" ] && [ "${LIBXML2_ROOT_DIR}" != "/usr" ]; then
CMAKE_OPTIONS+=" -DLIBXML2_INCLUDE_DIR:STRING=${LIBXML2_ROOT_DIR}/include/libxml2"
CMAKE_OPTIONS+=" -DLIBXML2_LIBRARIES:STRING=${LIBXML2_ROOT_DIR}/lib/libxml2.so"
CMAKE_OPTIONS+=" -DLIBXML2_XMLLINT_EXECUTABLE=${LIBXML2_ROOT_DIR}/bin/xmllint"
fi
# HDF5
-if [ "${HDF5_ROOT_DIR}" != "/usr" ]
-then
+if [ -n "$HDF5_ROOT_DIR" ] && [ "${HDF5_ROOT_DIR}" != "/usr" ]; then
CMAKE_OPTIONS+=" -DHDF5_DIR:PATH=${HDF5_ROOT_DIR}/share/cmake/hdf5"
CMAKE_OPTIONS+=" -DHDF5_USE_STATIC_LIBRARIES:BOOL=OFF"
CMAKE_OPTIONS+=" -DHDF5_ROOT:PATH=${HDF5_ROOT_DIR}"
fi
# CMINPACK
-if [ "${CMINPACK_ROOT_DIR}" != "/usr" ]
-then
+if [ "${CMINPACK_ROOT_DIR}" != "/usr" ]; then
CMAKE_OPTIONS+=" -DCMINPACK_ROOT_DIR=${CMINPACK_ROOT_DIR}"
CMAKE_OPTIONS+=" -DCMINPACK_INCLUDE_DIR=${CMINPACK_ROOT_DIR}/include/cminpack-1"
CMAKE_OPTIONS+=" -DCMINPACK_LIBRARY=$CMINPACK_ROOT_DIR/lib/libcminpack_s.a"
CMAKE_OPTIONS+=" -DCBLAS_LIBRARIES=$LAPACK_ROOT_DIR/lib/libcblas.so"
fi
### libxml2 settings
-if [ -n "$LIBXML2_ROOT_DIR" ]
-then
- # with a native libxml2, do not use these options
- if [ "${LIBXML2_ROOT_DIR}" != "/usr" ]
- then
- CMAKE_OPTIONS+=" -DLIBXML2_INCLUDE_DIR:STRING=${LIBXML2_ROOT_DIR}/include/libxml2"
- CMAKE_OPTIONS+=" -DLIBXML2_LIBRARIES:STRING=${LIBXML2_ROOT_DIR}/lib/libxml2.so"
- CMAKE_OPTIONS+=" -DLIBXML2_XMLLINT_EXECUTABLE=${LIBXML2_ROOT_DIR}/bin/xmllint"
- fi
+if [ -n "$LIBXML2_ROOT_DIR" ] && [ "${LIBXML2_ROOT_DIR}" != "/usr" ]; then
+ CMAKE_OPTIONS+=" -DLIBXML2_INCLUDE_DIR:STRING=${LIBXML2_ROOT_DIR}/include/libxml2"
+ CMAKE_OPTIONS+=" -DLIBXML2_LIBRARIES:STRING=${LIBXML2_ROOT_DIR}/lib/libxml2.so"
+ CMAKE_OPTIONS+=" -DLIBXML2_XMLLINT_EXECUTABLE=${LIBXML2_ROOT_DIR}/bin/xmllint"
+fi
+
+## nlopt
+if [ -n "$NLOPT_ROOT_DIR" ] && [ "${NLOPT_ROOT_DIR}" != "/usr" ]; then
+ CMAKE_OPTIONS+=" -DNLOPT_INCLUDE_DIRS:STRING=${NLOPT_ROOT_DIR}/include"
+ CMAKE_OPTIONS+=" -DNLOPT_LIBRARIES:STRING=${NLOPT_ROOT_DIR}/lib"
+ CMAKE_OPTIONS+=" -DNLOPT_DIR:STRING=${NLOPT_ROOT_DIR}"
fi
echo
diff -Naur openturns-1.17_ref/openturns-1.17/CMakeLists.txt openturns-1.17_new/openturns-1.17/CMakeLists.txt
---- openturns-1.17_ref/openturns-1.17/CMakeLists.txt 2021-09-21 13:28:10.257960906 +0200
-+++ openturns-1.17_new/openturns-1.17/CMakeLists.txt 2021-09-21 13:37:49.975423413 +0200
+--- openturns-1.17_ref/openturns-1.17/CMakeLists.txt 2021-09-21 13:59:56.000000000 +0200
++++ openturns-1.17_new/openturns-1.17/CMakeLists.txt 2021-10-04 13:27:16.893096795 +0200
@@ -133,6 +133,11 @@
set (CMAKE_CXX_STANDARD 11)
find_package (Boost 1.46)
if (Boost_FOUND)
if (CMAKE_VERSION VERSION_LESS 3.15)
-@@ -272,6 +305,10 @@
+@@ -272,7 +305,11 @@
endif ()
if (USE_NLOPT)
+- find_package (NLopt CONFIG QUIET)
+ SET(NLOPT_ROOT_DIR $ENV{NLOPT_ROOT_DIR} CACHE PATH "Path to the NLOPT.")
+ IF(NLOPT_ROOT_DIR)
+ LIST(APPEND CMAKE_PREFIX_PATH "${NLOPT_ROOT_DIR}")
+ ENDIF(NLOPT_ROOT_DIR)
- find_package (NLopt CONFIG QUIET)
++ find_package (NLopt)
if (NLopt_FOUND)
message(STATUS "Found NLopt: ${NLopt_DIR}")
+ else ()
@@ -336,22 +373,22 @@
endif ()