Minor fixes to the build scripts for MSVC debug builds, and added debug library suppo...
[quassel.git] / cmake / modules / QuasselMacros.cmake
1 # This macro sets variables for additional Qt modules.
2 # We need this because targets need different Qt4 modules, i.e. different libs
3 # and defines. We can't simply include UseQt4 several times, since definitions add up.
4 # We workaround this by using our own macro to figure out what to add.
5
6 macro(setup_qt4_variables)
7   set(QUASSEL_QT_LIBRARIES )
8   IF(WIN32)
9     set(MAIN MAIN)
10   ENDIF(WIN32)
11   foreach(qtmod CORE ${ARGV} ${MAIN})
12     set(QUASSEL_QT_LIBRARIES ${QUASSEL_QT_LIBRARIES} ${QT_QT${qtmod}_LIBRARY})
13     if(STATIC)
14       set(QUASSEL_QT_LIBRARIES ${QUASSEL_QT_LIBRARIES} ${QT_${qtmod}_LIB_DEPENDENCIES})
15     endif(STATIC)
16   endforeach(qtmod ${ARGV})
17   set(QUASSEL_QT_LIBRARIES ${QUASSEL_QT_LIBRARIES} ${QT_LIBRARIES})
18 endmacro(setup_qt4_variables)
19
20 # This generates a .ts from a .po file
21 macro(generate_ts outvar basename)
22   set(input ${basename}.po)
23   set(output ${CMAKE_BINARY_DIR}/po/${basename}.ts)
24   add_custom_command(OUTPUT ${output}
25           COMMAND ${QT_LCONVERT_EXECUTABLE}
26           ARGS -i ${input}
27                -of ts
28                -o ${output}
29           WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/po
30 # This is a workaround to add (duplicate) strings that lconvert missed to the .ts
31           COMMAND ${QT_LUPDATE_EXECUTABLE}
32           ARGS -silent
33                ${CMAKE_SOURCE_DIR}/src/
34                -ts ${output}
35           DEPENDS ${basename}.po)
36   set(${outvar} ${output})
37 endmacro(generate_ts outvar basename)
38
39 # This generates a .qm from a .ts file
40 macro(generate_qm outvar basename)
41   set(input ${CMAKE_BINARY_DIR}/po/${basename}.ts)
42   set(output ${CMAKE_BINARY_DIR}/po/${basename}.qm)
43   add_custom_command(OUTPUT ${output}
44           COMMAND ${QT_LRELEASE_EXECUTABLE}
45           ARGS -silent
46                ${input}
47           DEPENDS ${basename}.ts)
48   set(${outvar} ${output})
49 endmacro(generate_qm outvar basename)