diff --git a/avogadro/CMakeLists.txt b/avogadro/CMakeLists.txt index 88f93531..23e97f14 100644 --- a/avogadro/CMakeLists.txt +++ b/avogadro/CMakeLists.txt @@ -87,7 +87,11 @@ if(Avogadro_ENABLE_RPC) endif() if(ENABLE_TESTING) +if(QT_VERSION EQUAL 6) + find_package(Qt6 COMPONENTS Test REQUIRED) +elseif(QT_VERSION EQUAL 5) find_package(Qt5 COMPONENTS Test REQUIRED) +endif() find_package(QtTesting REQUIRED NO_MODULE) include_directories(${QtTesting_INCLUDE_DIRS}) link_directories(${QtTesting_LIBRARY_DIR}) @@ -179,8 +183,10 @@ add_executable(avogadro WIN32 MACOSX_BUNDLE target_link_libraries(avogadro Qt::Widgets Qt::Network Qt::Concurrent) if(WIN32) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:MSVCRTD") +if(QT_VERSION EQUAL 5) target_link_libraries(avogadro Qt::WinMain) endif() +endif() set_target_properties(avogadro PROPERTIES AUTOMOC TRUE) target_link_libraries(avogadro Avogadro::QtOpenGL Avogadro::QtGui Avogadro::QtPlugins) if(Avogadro_ENABLE_RPC)