chiark / gitweb /
Cleaner way to fix ctest (#144)
[nlopt.git] / test / CMakeLists.txt
index e17d12763db6dc3a14ba49f0f8f603596681e9da..7ee60cf0ef5601d083dc1166bac876018dbe5585 100644 (file)
@@ -1,7 +1,8 @@
 add_custom_target (tests)
 
 # have to add timer.c and mt19937ar.c as symbols are declared extern
-add_executable (testopt testfuncs.c testfuncs.h testopt.cpp ${PROJECT_SOURCE_DIR}/util/timer.c ${PROJECT_SOURCE_DIR}/util/mt19937ar.c)
+add_executable (testopt testfuncs.c testfuncs.h testopt.c
+  ${PROJECT_SOURCE_DIR}/util/timer.c ${PROJECT_SOURCE_DIR}/util/mt19937ar.c ${CMAKE_SOURCE_DIR}/util/nlopt-getopt.c)
 target_link_libraries (testopt ${nlopt_lib})
 target_include_directories (testopt PRIVATE ${NLOPT_PRIVATE_INCLUDE_DIRS})
 add_dependencies (tests testopt)
@@ -25,6 +26,9 @@ foreach (algo_index RANGE 29)# 42
     endif ()
     if (enable_)
       add_test (NAME testopt_algo${algo_index}_obj${obj_index} COMMAND testopt -a ${algo_index} -o ${obj_index})
+      if (WIN32)
+        set_tests_properties (testopt_algo${algo_index}_obj${obj_index} PROPERTIES ENVIRONMENT "PATH=${PROJECT_BINARY_DIR}\\${CMAKE_BUILD_TYPE};$ENV{PATH}")  # to load dll
+      endif ()
     endif ()
   endforeach ()
 endforeach ()