[cmake-developers] [CMake 0012644]: Modules/Qt4Macros.cmake: qt4_create_translation: missing include paths
Mantis Bug Tracker
mantis at public.kitware.com
Sat Dec 31 09:17:57 EST 2011
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=12644
======================================================================
Reported By: Bernd Lörwald
Assigned To:
======================================================================
Project: CMake
Issue ID: 12644
Category: Modules
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2011-12-31 09:17 EST
Last Modified: 2011-12-31 09:17 EST
======================================================================
Summary: Modules/Qt4Macros.cmake: qt4_create_translation:
missing include paths
Description:
The macro does not give lupdate the include paths given in the makefile,
therefore lupdate produces warnings like "Qualifying with unknown
namespace/class ::Foo" and possibly bad files. lupdate needs the class
definition to not throw these warnings.
Steps to Reproduce:
As found in the attachment:
./CMakeLists.txt
./src/foo.cpp
./src/foo.h
CMakeLists:
...
include_directories (${CMAKE_CURRENT_SOURCE_DIR}) # ./
qt4_create_translation (QM_FILES ${SOURCE} ${TRANSLATIONS})
qt4_add_translation (QM ${TRANSLATIONS})
...
src/foo.cpp:
#include <src/foo.h>
...
void Foo::greet() const
{
qDebug() << tr ("greeting");
}
...
[ 20%] Generating ../translation.ts
src/foo.cpp:8: Qualifying with unknown namespace/class ::Foo
Additional Information:
The macro uses an temporary .pro file "CMakeFiles/translation_lupdate.pro". This
includes only "SOURCES=../src/foo.cpp", while it should also include
"INCLUDEPATH=..".
To fix this, do:
- FILE(WRITE ${_ts_pro} "SOURCES = ${_pro_srcs}")
+ # TODO: get paths into ${include_paths}
+ SET(_pro_includes)
+ FOREACH(_pro_include ${include_paths})
+ GET_FILENAME_COMPONENT(_abs_include
"${CMAKE_BINARY_DIR}/${_pro_include}" ABSOLUTE)
+ SET(_pro_includes "${_pro_includes} \"${_abs_include}\"")
+ ENDFOREACH(_pro_include ${CMAKE_CXX_INCLUDE_PATH})
+ FILE(WRITE ${_ts_pro} "SOURCES = ${_pro_srcs}\nINCLUDEPATH =
${_pro_includes}\n")
I do not know how to get the include paths though. That's for you to fix.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2011-12-31 09:17 Bernd Lörwald New Issue
2011-12-31 09:17 Bernd Lörwald File Added: lupdate_example.zip
======================================================================
More information about the cmake-developers
mailing list