modernized the cmake <-> Qt handling.

This commit is contained in:
2021-12-01 15:25:38 +01:00
parent 1aa7ae7f0d
commit 5b94d4d302
8 changed files with 214 additions and 307 deletions

View File

@@ -1,4 +1,4 @@
#--- musrWiz for Qt > 6.0 -----------------------------------------------------
#--- musrWiz for Qt = 6.x -----------------------------------------------------
#--- check if project source is repo ------------------------------------------
if (IS_GIT_REPO)
@@ -7,6 +7,13 @@ else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
endif (IS_GIT_REPO)
#--- instruct CMake to run moc automatically when needed ----------------------
set(CMAKE_AUTOMOC ON)
#--- deal with the resources --------------------------------------------------
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(qt_libs Qt6::Core Qt6::Widgets Qt6::Svg Qt6::Xml)
set(musrWiz_src
@@ -18,34 +25,17 @@ set(musrWiz_src
musrWiz.cpp
)
# Instruct CMake to run moc automatically when needed
set(CMAKE_AUTOMOC ON)
#[==[
# as35 currently CMAKE_AUTOUIC -> ON doesn't work since it requires the ui-files
# in the same directory as the cpp-files.
# Create code from a list of Qt designer ui files
set(CMAKE_AUTOUIC ON)
#]==]
set(CMAKE_AUTOUIC OFF)
# add qt/rcc
qt6_add_resources(musrWiz_rcc musrWiz.qrc)
# remove generated files from automoc and autouic
set_property(SOURCE qrc_musrWiz.cpp PROPERTY SKIP_AUTOMOC ON)
set(macosx_icon icons/musrWiz.icns)
if (APPLE)
add_executable(musrWiz MACOSX_BUNDLE
${musrWiz_src}
${musrWiz_rcc}
musrWiz.qrc
${macosx_icon}
)
else (APPLE)
add_executable(musrWiz
${musrWiz_src}
${musrWiz_rcc}
musrWiz.qrc
)
endif (APPLE)
@@ -63,7 +53,7 @@ target_compile_options(musrWiz
"${HAVE_GIT_REV_H}"
)
target_link_libraries(musrWiz ${qt_libs})
target_link_libraries(musrWiz PRIVATE ${qt_libs})
#--- installation info --------------------------------------------------------
if (APPLE)