Commit 6eeed36f authored by Ben Boeckel's avatar Ben Boeckel

cmake: simplify some code

Imported targets bring flags with them automatically.
parent 1f4e43c7
Pipeline #88405 passed with stage
......@@ -15,6 +15,4 @@ add_executable (TestingDemo
)
target_link_libraries(TestingDemo
QtTesting)
set_target_properties(TestingDemo PROPERTIES
COMPILE_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
PRIVATE QtTesting)
FIND_PACKAGE(Qt5 REQUIRED QUIET COMPONENTS Test)
set(KIT ${PROJECT_NAME})
set(TEST_SOURCES
pqAbstractButtonEventTranslatorTest.cpp
pqEventPlayerTest.cpp
......@@ -14,25 +12,23 @@ set(TEST_SOURCES
pqTestUtilityTest.cpp
)
create_test_sourcelist(Tests ${KIT}CppTests.cxx
create_test_sourcelist(Tests QtTestingCppTests.cxx
${TEST_SOURCES}
)
set(TestsToRun ${Tests})
remove(TestsToRun ${KIT}CppTests.cxx)
remove(TestsToRun QtTestingCppTests.cxx)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
add_executable(${KIT}CppTests ${Tests} ${TEST_SOURCES})
target_link_libraries(${KIT}CppTests ${PROJECT_NAME} Qt5::Test)
set_target_properties(${KIT}CppTests PROPERTIES
COMPILE_FLAGS "${Qt5Test_EXECUTABLE_COMPILE_FLAGS}")
add_executable(QtTestingCppTests ${Tests} ${TEST_SOURCES})
target_link_libraries(QtTestingCppTests ${PROJECT_NAME} Qt5::Test)
macro(SIMPLE_TEST testname)
add_test(NAME ${testname} COMMAND $<TARGET_FILE:${KIT}CppTests> ${testname} ${ARGN})
add_test(NAME ${testname} COMMAND QtTestingCppTests ${testname} ${ARGN})
endmacro()
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment