MantisBT - CMake
View Issue Details
0014969CMakeModulespublic2014-06-11 22:212015-01-05 08:38
Pulfer 
Clinton Stimpson 
normalblockalways
closedno change required 
LinuxROSA Desktop Fresh2014.1
CMake 3.0 
 
0014969: Changes in FindQt4 resulted in "Qt4::lrelease: command not found"
$ cat CMakeLists.txt
...
file(GLOB tsfiles *.ts)
...
QT4_ADD_TRANSLATION(QM ${tsfiles})

--------------------------------------

[ 91%] Generating hedgewars_sk.qm
/bin/sh: Qt4::lrelease: command not found
make[2]: *** [share/hedgewars/Data/Locale/hedgewars_sk.qm] Error 127
make[1]: *** [share/hedgewars/Data/Locale/CMakeFiles/release-translation.dir/all] Error 2
make: *** [all] Error 2


--------------------------------------

$ grep lrelease * -r
CMakeCache.txt:QT_LRELEASE_EXECUTABLE:FILEPATH=/usr/lib/qt4/bin/lrelease
share/hedgewars/Data/Locale/CMakeFiles/release-translation.dir/build.make: cd /home/vuohi/rpmbuild/BUILD/hedgewars-src-0.9.20/build/share/hedgewars/Data/Locale && Qt4::lrelease /home/vuohi/rpmbuild/BUILD/hedgewars-src-0.9.20/share/hedgewars/Data/Locale/hedgewars_pt_BR.ts -qm /home/vuohi/rpmbuild/BUILD/hedgewars-src-0.9.20/build/share/hedgewars/Data/Locale/hedgewars_pt_BR.qm
...
Try to build hedgewars 0.9.20.5 with cmake 3.0.
No tags attached.
Issue History
2014-06-11 22:21PulferNew Issue
2014-06-12 09:16Brad KingAssigned To => Clinton Stimpson
2014-06-12 09:16Brad KingStatusnew => assigned
2014-06-12 09:52Clinton StimpsonNote Added: 0036167
2014-06-17 05:37PulferNote Added: 0036210
2014-06-17 09:47Clinton StimpsonNote Added: 0036212
2014-06-18 10:18Brad KingNote Added: 0036216
2014-06-18 10:52Clinton StimpsonNote Added: 0036217
2014-06-18 10:52Clinton StimpsonStatusassigned => resolved
2014-06-18 10:52Clinton StimpsonResolutionopen => no change required
2015-01-05 08:38Robert MaynardNote Added: 0037567
2015-01-05 08:38Robert MaynardStatusresolved => closed

Notes
(0036167)
Clinton Stimpson   
2014-06-12 09:52   
This is a scope problem in the hedgewars CMakeLists.txt files.
The QT_LRELEASE_EXECUTABLE variable has global scope, and the Qt4::lrelease target does not.

Modifying it to do the following solves the problem.

find_package(Qt4)
QT4_ADD_TRANSLATION(QM ${tsfiles})
(0036210)
Pulfer   
2014-06-17 05:37   
But is adding "find_package(Qt4)" solution or workaround?
(0036212)
Clinton Stimpson   
2014-06-17 09:47   
I believe adding a find_package (Qt4) is a solution not a workaround.

If you want other opinions, you can ask on the mailing list.
(0036216)
Brad King   
2014-06-18 10:18   
Adding find_package(Qt4) is the solution and will work with the older CMake versions too. The scope of a find_package result is the calling directory and its descendant directories.
(0036217)
Clinton Stimpson   
2014-06-18 10:52   
No change required to CMake.
(0037567)
Robert Maynard   
2015-01-05 08:38   
Closing resolved issues that have not been updated in more than 4 months.