Skip to content

Commit

Permalink
CMake: Simplify test setup.
Browse files Browse the repository at this point in the history
* Enable C++11 for test_potassco_opts and reduce duplication in cmake
  test configuration.
  • Loading branch information
BenKaufmann committed Mar 18, 2024
1 parent a8048a1 commit 4c9e27b
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,7 @@ set(test_lp
main.cpp
)
add_executable(test_potassco_lp ${test_lp})
target_link_libraries(test_potassco_lp libpotassco)
target_include_directories(test_potassco_lp PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
set_target_properties(test_potassco_lp PROPERTIES
CXX_STANDARD 11
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED YES
)

set(test_opts
test_application.cpp
test_options.cpp
Expand All @@ -24,12 +16,18 @@ set(test_opts
)

add_executable(test_potassco_opts ${test_opts})
target_link_libraries(test_potassco_opts libpotassco)
target_include_directories(test_potassco_opts PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)

foreach(target test_potassco_lp test_potassco_opts)
message(STATUS "Processing ${target}")
target_link_libraries(${target} libpotassco)
target_include_directories(${target} PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
set_target_properties(${target} PROPERTIES
CXX_STANDARD 11
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED YES
FOLDER test
)
endforeach()

add_test(NAME test_lp COMMAND test_potassco_lp)
add_test(NAME test_opts COMMAND test_potassco_opts)
set_target_properties(test_potassco_lp PROPERTIES FOLDER test)
set_target_properties(test_potassco_opts PROPERTIES FOLDER test)

0 comments on commit 4c9e27b

Please sign in to comment.