MantisBT - CMake
View Issue Details
0013433CMakeModulespublic2012-07-24 01:362013-01-09 14:05
Craig Scott 
Clinton Stimpson 
normalminoralways
closedfixed 
Linux 64-bitFedora16
CMake 2.8.8 
 
0013433: fixup_qt4_executable fails on Linux when used with CPack or DESTDIR
When CPack is used on a build where cmake has been run to set up the packaging, the fixup_qt4_executable() functon (defined in the DeployQt4 module) complains that it cannot find the executable. This only occurs on Linux. The same files work as expected on Windows (I don't have access to Mac to test on there, sorry).

What is interesting is that if I look at the cmake_install.cmake file that is generated by CMake, both contain a line like one of the following:

FIXUP_QT4_EXECUTABLE("${CMAKE_INSTALL_PREFIX}/bin/myExe" "" "" "/usr/lib64;/usr/lib64/qt4/bin" "" "")

FIXUP_QT4_EXECUTABLE("${CMAKE_INSTALL_PREFIX}/bin/myExe.exe" "" "" "C:/QtSDK/Desktop/Qt/4.8.1/msvc2008/lib;C:/QtSDK/Desktop/Qt/4.8.1/msvc2008/bin" "" "")

If I run CPack on these, it works fine on Windows, but on Linux it complains that it cannot find the executable. It is as though the DESTDIR used by CPack to get "make install" to install to a private area is not understood by fixup_qt4_executable(). Why it works on Windows but not on Linux is unclear. I also confirm that simply doing a "make DESTDIR=somewhere install" also fails in a similar fashion, so it is not a problem with CPack.
See the simple example (I'll attach the files shortly). On linux, run cmake and then do a make install with DESTDIR set to somewhere.
qt
txt CMakeLists.txt (289) 2012-07-24 01:36
https://public.kitware.com/Bug/file/4404/CMakeLists.txt
cpp main.cpp (130) 2012-07-24 01:36
https://public.kitware.com/Bug/file/4405/main.cpp
? CMakeLists.txt.updated (293) 2012-07-24 01:53
https://public.kitware.com/Bug/file/4406/CMakeLists.txt.updated
Issue History
2012-07-24 01:36Craig ScottNew Issue
2012-07-24 01:36Craig ScottFile Added: CMakeLists.txt
2012-07-24 01:36Craig ScottFile Added: main.cpp
2012-07-24 01:53Craig ScottFile Added: CMakeLists.txt.updated
2012-07-24 01:54Craig ScottNote Added: 0030114
2012-07-24 01:56Craig ScottTag Attached: qt
2012-07-24 02:20Craig ScottNote Added: 0030115
2012-07-24 04:50Mike McQuaidNote Added: 0030117
2012-07-24 19:41Craig ScottNote Added: 0030121
2012-07-25 04:32Mike McQuaidNote Added: 0030122
2012-07-27 16:52Alex NeundorfAssigned To => Clinton Stimpson
2012-07-27 16:52Alex NeundorfStatusnew => assigned
2012-08-15 21:40Clinton StimpsonNote Added: 0030683
2012-08-15 21:40Clinton StimpsonStatusassigned => resolved
2012-08-15 21:40Clinton StimpsonResolutionopen => fixed
2013-01-09 14:05Robert MaynardNote Added: 0032071
2013-01-09 14:05Robert MaynardStatusresolved => closed

Notes
(0030114)
Craig Scott   
2012-07-24 01:54   
Sorry, the original CMakeLists.txt had a bad path in the install_qt4_executable() line. The CMakeLists.txt.update is the one to look at (I can't seem to delete the original CMakeLists.txt from this issue, sorry).
(0030115)
Craig Scott   
2012-07-24 02:20   
Er, actually you can reproduce the problem on Windows too with a simple "nmake DESTDIR=somewhere install" as well. Note that CPack *does* happily produce a package on Windows though, so there's something odd going on.

Also, on Windows, the executable passed to install_qt4_executable() should have .exe appended to it.

Finally, to test with CPack, you also need to append a line with "include(CPack)" to the bottom of the CMakeLists.txt file. Sorry, I threw this example together quickly since I was doing my earlier investigations with a much larger and more complex set of files.
(0030117)
Mike McQuaid   
2012-07-24 04:50   
Yes, it's exactly what you suspected: an issue with the DESTDIR. You have to pass the full path to FIXUP_QT4_EXECUTABLE (but it will try the CMAKE_INSTALL_PREFIX which sometimes works).

I'd advise you to use INSTALL_QT4_EXECUTABLE instead or manually set the full path.
(0030121)
Craig Scott   
2012-07-24 19:41   
Unfortunately, that's not possible. Whatever you do with install_qt4_executable, it prepends ${CMAKE_INSTALL_PREFIX} to the executable name. The problem is, the DESTDIR part needs to go *before* CMAKE_INSTALL_PREFIX. You can't modify CMAKE_INSTALL_PREFIX because that's used by CPack when working out the base install path.
(0030122)
Mike McQuaid   
2012-07-25 04:32   
Ah, ok, thanks.
(0030683)
Clinton Stimpson   
2012-08-15 21:40   
Fixed.

http://www.cmake.org/gitweb?p=cmake.git;a=commit;h=1e3248c9d0396e9c8b417eb35636ed951ca85988 [^]
(0032071)
Robert Maynard   
2013-01-09 14:05   
Closing resolved issues that have not been updated in more than 4 months.