Tests/RunCMake/Autogen: Factor out test setup

This commit is contained in:
Orkun Tokdemir
2023-09-25 15:40:54 +02:00
committed by Brad King
parent 9654835b4f
commit c3f0825d3c
6 changed files with 39 additions and 33 deletions
@@ -1,17 +1,9 @@
enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui)
include(MocExample.cmake)
if(NOT TARGET Qt${with_qt_version}::moc)
message(FATAL_ERROR "Qt${with_qt_version}::moc not found")
endif()
add_library(dummy STATIC example.cpp)
target_link_libraries(dummy Qt${with_qt_version}::Core
Qt${with_qt_version}::Widgets
Qt${with_qt_version}::Gui)
get_target_property(moc_location Qt${with_qt_version}::moc IMPORTED_LOCATION)
set_target_properties(dummy PROPERTIES AUTOMOC_MOC_OPTIONS "EXE_PATH=${moc_location}")
@@ -20,5 +12,4 @@ add_executable(mymoc $<$<CONFIG:Debug>:exe_debug.cpp>
$<$<CONFIG:RelWithDebInfo>:exe_relwithdebinfo.cpp>
)
set_target_properties(dummy PROPERTIES AUTOMOC_EXECUTABLE $<TARGET_FILE:mymoc>
AUTOMOC ON)
set_target_properties(dummy PROPERTIES AUTOMOC_EXECUTABLE $<TARGET_FILE:mymoc>)
@@ -1,17 +1,9 @@
enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui)
include(RccExample.cmake)
if(NOT TARGET Qt${with_qt_version}::rcc)
message(FATAL_ERROR "Qt${with_qt_version}::rcc not found")
endif()
add_library(dummy STATIC example.cpp data.qrc)
target_link_libraries(dummy Qt${with_qt_version}::Core
Qt${with_qt_version}::Widgets
Qt${with_qt_version}::Gui)
get_target_property(rcc_location Qt${with_qt_version}::rcc IMPORTED_LOCATION)
set_target_properties(dummy PROPERTIES AUTORCC_OPTIONS "EXE_PATH=${rcc_location}")
@@ -20,5 +12,4 @@ add_executable(myrcc $<$<CONFIG:Debug>:exe_debug.cpp>
$<$<CONFIG:RelWithDebInfo>:exe_relwithdebinfo.cpp>
)
set_target_properties(dummy PROPERTIES AUTORCC_EXECUTABLE $<TARGET_FILE:myrcc>
AUTORCC ON)
set_target_properties(dummy PROPERTIES AUTORCC_EXECUTABLE $<TARGET_FILE:myrcc>)
@@ -1,17 +1,9 @@
enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui)
include(UicExample.cmake)
if(NOT TARGET Qt${with_qt_version}::uic)
message(FATAL_ERROR "Qt${with_qt_version}::uic not found")
endif()
add_library(dummy STATIC example_ui.cpp uiA.ui)
target_link_libraries(dummy Qt${with_qt_version}::Core
Qt${with_qt_version}::Widgets
Qt${with_qt_version}::Gui)
get_target_property(uic_location Qt${with_qt_version}::uic IMPORTED_LOCATION)
set_target_properties(dummy PROPERTIES AUTOUIC_OPTIONS "EXE_PATH=${uic_location}")
@@ -20,5 +12,4 @@ add_executable(myuic $<$<CONFIG:Debug>:exe_debug.cpp>
$<$<CONFIG:RelWithDebInfo>:exe_relwithdebinfo.cpp>
)
set_target_properties(dummy PROPERTIES AUTOUIC_EXECUTABLE $<TARGET_FILE:myuic>
AUTOUIC ON)
set_target_properties(dummy PROPERTIES AUTOUIC_EXECUTABLE $<TARGET_FILE:myuic>)
+11
View File
@@ -0,0 +1,11 @@
enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui)
add_library(dummy STATIC example.cpp)
target_link_libraries(dummy Qt${with_qt_version}::Core
Qt${with_qt_version}::Widgets
Qt${with_qt_version}::Gui)
set_target_properties(dummy PROPERTIES AUTOMOC ON)
+11
View File
@@ -0,0 +1,11 @@
enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui)
add_library(dummy STATIC example.cpp data.qrc)
target_link_libraries(dummy Qt${with_qt_version}::Core
Qt${with_qt_version}::Widgets
Qt${with_qt_version}::Gui)
set_target_properties(dummy PROPERTIES AUTORCC ON)
+11
View File
@@ -0,0 +1,11 @@
enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui)
add_library(dummy STATIC example_ui.cpp uiA.ui)
target_link_libraries(dummy Qt${with_qt_version}::Core
Qt${with_qt_version}::Widgets
Qt${with_qt_version}::Gui)
set_target_properties(dummy PROPERTIES AUTOUIC ON)