Skip to content

Commit

Permalink
CMake: improve handling of gecode-test
Browse files Browse the repository at this point in the history
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:
Gecode#200
  • Loading branch information
LebedevRI committed Aug 23, 2024
1 parent f7f0d7c commit e26386d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ if (FLOATSRC)
endif ()

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

add_executable(fzn-gecode ${FLATZINCEXESRC})
Expand Down Expand Up @@ -428,13 +429,13 @@ endif()

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

option(BUILD_EXAMPLES "Build examples." OFF)
option(BUILD_EXAMPLES "Build examples." OFF)
if (${BUILD_EXAMPLES})
add_subdirectory(examples)
endif()

enable_testing()
add_test(test gecode-test
add_test(NAME test COMMAND gecode-test
-iter 2 -test Branch::Int::Dense::3
-test Int::Linear::Int::Int::Eq::Bnd::12::4
-test Int::Distinct::Random
Expand Down

0 comments on commit e26386d

Please sign in to comment.