Add support for finding lconvert to our own buildsystem
authorManuel Nickschas <sputnick@quassel-irc.org>
Sun, 1 Apr 2012 21:00:09 +0000 (23:00 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 1 Apr 2012 22:07:17 +0000 (00:07 +0200)
Since neither Qt4 nor Qt5 seem to deem lconvert a relevant binary, their cmake fu does
not look for lconvert. Rather than shipping rapidly outdating copies of FindQt4.cmake or the
Qt5 equivalents, let's rather guess the location of lconvert based on the other tools.

CMakeLists.txt

index 4c6c1a5..3170180 100644 (file)
@@ -187,6 +187,10 @@ if(WITH_QT5)
   find_package(Qt5Core ${QT_MIN_VERSION} REQUIRED)
   # We need QtWidgets
   set(CLIENT_QT_MODULES ${CLIENT_QT_MODULES} Widgets)
+
+  # Setup the i18n-related variables
+  find_package(Qt5LinguistTools)
+
 else(WITH_QT5)
   # Select a Qt installation here, if you don't want to use system Qt
   if(QT)
@@ -199,6 +203,18 @@ else(WITH_QT5)
 endif(WITH_QT5)
 
 
+# Neither Qt4 nor Qt5 consider lconvert relevant, so they don't support finding it...
+# Rather than shipping hacked buildsys files, let's just infer the path from lrelease
+if(QT_LRELEASE_EXECUTABLE)
+  get_filename_component(_lrelease_path ${QT_LRELEASE_EXECUTABLE} PATH)
+  if(WITH_QT5)
+    find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert-qt5 lconvert PATHS ${_lrelease_path} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+  else(WITH_QT5)
+    find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert-qt4 lconvert PATHS ${_lrelease_path} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+  endif(WITH_QT5)
+endif(QT_LRELEASE_EXECUTABLE)
+
+
 # Execinfo is needed for generating backtraces
 find_package(ExecInfo)
 if(EXECINFO_FOUND)
@@ -466,7 +482,6 @@ if(NOT WIN32)
   endif(HAVE_UMASK)
 endif(NOT WIN32)
 
-
 # We need to create a version.gen
 # For this, we create our genversion binary and make sure it is run every time.