Skip to content

Commit e26386d

Browse files
committed
CMake: improve handling of gecode-test
Ensure that it gets built when testing is enabled, and that CMake actually uses said executable target, and not some binary. That being said, the test does not pass with assertions enabled: #200
1 parent f7f0d7c commit e26386d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ if (FLOATSRC)
389389
endif ()
390390

391391
add_executable(gecode-test EXCLUDE_FROM_ALL ${TESTSRC} ${TESTHDR})
392+
set_target_properties(gecode-test PROPERTIES EXCLUDE_FROM_ALL $<NOT:$<BOOL:${BUILD_TESTING}>>)
392393
target_link_libraries(gecode-test gecodeflatzinc gecodeminimodel)
393394

394395
add_executable(fzn-gecode ${FLATZINCEXESRC})
@@ -428,13 +429,13 @@ endif()
428429

429430
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
430431

431-
option(BUILD_EXAMPLES "Build examples." OFF)
432+
option(BUILD_EXAMPLES "Build examples." OFF)
432433
if (${BUILD_EXAMPLES})
433434
add_subdirectory(examples)
434435
endif()
435436

436437
enable_testing()
437-
add_test(test gecode-test
438+
add_test(NAME test COMMAND gecode-test
438439
-iter 2 -test Branch::Int::Dense::3
439440
-test Int::Linear::Int::Int::Eq::Bnd::12::4
440441
-test Int::Distinct::Random

0 commit comments

Comments
 (0)