chiark / gitweb /
Set PATH on windows hosts only
[nlopt.git] / CMakeLists.txt
index 46962d6e1b5dbf1b02946030be072be9bd50d63c..d9fb57bcd0bf5a33211784e92f6f2adf5b125746 100644 (file)
@@ -46,6 +46,12 @@ option (NLOPT_GUILE "build guile bindings" ON)
 option (NLOPT_SWIG "use SWIG to build bindings" ON)
 option (NLOPT_LINK_PYTHON "link Python libs" ON)
 
+if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
+  option (NLOPT_TESTS "build unit tests" ON)
+else ()
+  option (NLOPT_TESTS "build unit tests" OFF)
+endif ()
+
 set (NLOPT_SUFFIX)
 if (NLOPT_CXX)
   set (NLOPT_SUFFIX _cxx)
@@ -324,8 +330,10 @@ if (OCTAVE_FOUND OR Matlab_FOUND)
   add_subdirectory (src/octave)
 endif ()
 
-enable_testing ()
-add_subdirectory (test)
+if (NLOPT_TESTS)
+  enable_testing ()
+  add_subdirectory (test)
+endif ()
 
 set (CPACK_PACKAGE_NAME          "${CMAKE_PROJECT_NAME}")
 set (CPACK_PACKAGE_VERSION_MAJOR "${NLOPT_MAJOR_VERSION}")