comparison ui/CMakeLists.txt @ 561:4433f9d57f6d

Add resources to main. You can not add resources to a library
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 22 May 2014 13:23:07 +0000
parents 3af16cbc961d
children 8728ae882b6a
comparison
equal deleted inserted replaced
560:3af16cbc961d 561:4433f9d57f6d
101 generate_cppcheck(SOURCES ${CINST_SOURCES} ${TRUSTBRIDGE_SOURCES} TARGET_NAME custom_cppcheck) 101 generate_cppcheck(SOURCES ${CINST_SOURCES} ${TRUSTBRIDGE_SOURCES} TARGET_NAME custom_cppcheck)
102 add_dependencies(static_check custom_cppcheck) 102 add_dependencies(static_check custom_cppcheck)
103 103
104 # Adding resources here in an extra variable to enable reuse of 104 # Adding resources here in an extra variable to enable reuse of
105 # TRUSTBRIDGE_SOURCES in the test subdirectory. 105 # TRUSTBRIDGE_SOURCES in the test subdirectory.
106 set(TRUSTBRIDGE_SOURCES_WITH_RESOURCES ${TRUSTBRIDGE_SOURCES}) 106 set(TRUSTBRIDGE_MAIN_WITH_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)
107 qt5_add_resources(TRUSTBRIDGE_SOURCES_WITH_RESOURCES ${TRUSTBRIDGE_RESOURCES}) 107 qt5_add_resources(TRUSTBRIDGE_MAIN_WITH_RESOURCES ${TRUSTBRIDGE_RESOURCES})
108 108
109 set(ADMINSTRATOR_SOURCES_WITH_RESOURCES ${ADMINSTRATOR_SOURCES}) 109 set(ADMINSTRATOR_MAIN_WITH_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/administrator.cpp)
110 qt5_add_resources(ADMINSTRATOR_SOURCES_WITH_RESOURCES ${ADMINSTRATOR_RESOURCES}) 110 qt5_add_resources(ADMINSTRATOR_MAIN_WITH_RESOURCES ${ADMINSTRATOR_RESOURCES})
111 111
112 if(WIN32) 112 if(WIN32)
113 # This option causes cmake to use the appropiate liker flags to hide 113 # This option causes cmake to use the appropiate liker flags to hide
114 # the console Window on Windows 114 # the console Window on Windows
115 set (_add_executable_params WIN32) 115 set (_add_executable_params WIN32)
120 # This works in the source directory to enable the rcc dependencies to be found 120 # This works in the source directory to enable the rcc dependencies to be found
121 # and it also updates the currently available localization. 121 # and it also updates the currently available localization.
122 # This would probably be better placed in a macro 122 # This would probably be better placed in a macro
123 configure_file(l10n/administrator.qrc.in administrator.qrc) 123 configure_file(l10n/administrator.qrc.in administrator.qrc)
124 qt5_add_resources(ADMINISTRATOR_L10N ${CMAKE_CURRENT_BINARY_DIR}/administrator.qrc) 124 qt5_add_resources(ADMINISTRATOR_L10N ${CMAKE_CURRENT_BINARY_DIR}/administrator.qrc)
125 qt5_create_translation(ADMINISTRATOR_TRANSLATION ${ADMINSTRATOR_SOURCES_WITH_RESOURCES} 125 qt5_create_translation(ADMINISTRATOR_TRANSLATION ${ADMINSTRATOR_SOURCES}
126 ${CMAKE_CURRENT_SOURCE_DIR}/l10n/administrator_de_DE.ts) 126 ${CMAKE_CURRENT_SOURCE_DIR}/l10n/administrator_de_DE.ts)
127 add_executable(trustbridge-admin 127 add_executable(trustbridge-admin
128 ${_add_executable_params} 128 ${_add_executable_params}
129 ${CMAKE_CURRENT_SOURCE_DIR}/administrator.cpp 129 ${ADMINSTRATOR_MAIN_WITH_RESOURCES}
130 ${ADMINISTRATOR_L10N} 130 ${ADMINISTRATOR_L10N}
131 ${ADMINISTRATOR_TRANSLATION} 131 ${ADMINISTRATOR_TRANSLATION}
132 ) 132 )
133 133
134 configure_file(l10n/trustbridge.qrc.in trustbridge.qrc) 134 configure_file(l10n/trustbridge.qrc.in trustbridge.qrc)
135 qt5_add_resources(TRUSTBRIDGE_L10N ${CMAKE_CURRENT_BINARY_DIR}/trustbridge.qrc) 135 qt5_add_resources(TRUSTBRIDGE_L10N ${CMAKE_CURRENT_BINARY_DIR}/trustbridge.qrc)
136 qt5_create_translation(TRUSTBRIDGE_TRANSLATION ${TRUSTBRIDGE_SOURCES_WITH_RESOURCES} 136 qt5_create_translation(TRUSTBRIDGE_TRANSLATION ${TRUSTBRIDGE_SOURCES}
137 ${CMAKE_CURRENT_SOURCE_DIR}/l10n/trustbridge_de_DE.ts) 137 ${CMAKE_CURRENT_SOURCE_DIR}/l10n/trustbridge_de_DE.ts)
138 add_executable(trustbridge 138 add_executable(trustbridge
139 ${_add_executable_params} 139 ${_add_executable_params}
140 ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp 140 ${TRUSTBRIDGE_MAIN_WITH_RESOURCES}
141 ${TRUSTBRIDGE_L10N} 141 ${TRUSTBRIDGE_L10N}
142 ${TRUSTBRIDGE_TRANSLATION} 142 ${TRUSTBRIDGE_TRANSLATION}
143 ) 143 )
144 144
145 else() 145 else()
146 message (STATUS "WARNING: Could not find qt linguist tools. Translation will not be included.") 146 message (STATUS "WARNING: Could not find qt linguist tools. Translation will not be included.")
147 add_executable(trustbridge-admin 147 add_executable(trustbridge-admin
148 ${_add_executable_params} 148 ${_add_executable_params}
149 ${CMAKE_CURRENT_SOURCE_DIR}/administrator.cpp) 149 ${ADMINSTRATOR_MAIN_WITH_RESOURCES})
150 add_executable(trustbridge 150 add_executable(trustbridge
151 ${_add_executable_params} 151 ${_add_executable_params}
152 ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp) 152 ${TRUSTBRIDGE_MAIN_WITH_RESOURCES})
153 endif() 153 endif()
154 154
155 add_library(ui_common STATIC ${UICOMMON_SOURCES}) 155 add_library(ui_common STATIC ${UICOMMON_SOURCES})
156 add_library(tbadminlib STATIC ${ADMINSTRATOR_SOURCES_WITH_RESOURCES}) 156 add_library(tbadminlib STATIC ${ADMINSTRATOR_SOURCES})
157 add_library(tblib STATIC ${TRUSTBRIDGE_SOURCES_WITH_RESOURCES}) 157 add_library(tblib STATIC ${TRUSTBRIDGE_SOURCES})
158 158
159 target_link_libraries(trustbridge-admin 159 target_link_libraries(trustbridge-admin
160 tbadminlib 160 tbadminlib
161 Qt5::Widgets 161 Qt5::Widgets
162 ui_common 162 ui_common

http://wald.intevation.org/projects/trustbridge/