Handle files with includes from extra directories with lupdate.
authorStephen Kelly <stephen.kelly@kdab.com>
Tue, 19 Jun 2012 15:53:22 +0000 (17:53 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 20 Jun 2012 08:11:57 +0000 (10:11 +0200)
Forward port of 7a6d2796e63a8a390bd86fe9a029c4add119132b in cmake.git.
Change-Id: I35d05a6160e192e9ea0966fdd2ebc21ce2d73d24
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
src/linguist/Qt5LinguistToolsMacros.cmake
tests/manual/cmake/pass2/CMakeLists.txt
tests/manual/cmake/pass2/myi18nobject.cpp
tests/manual/cmake/pass2/some_dir/some_include.h [new file with mode: 0644]

index 1c29bb4..ba70c4a 100644 (file)
@@ -62,6 +62,13 @@ function(QT5_CREATE_TRANSLATION _qm_files)
           foreach(_lst_file_src ${_my_sources})
               set(_lst_file_srcs "${_lst_file_src}\n${_lst_file_srcs}")
           endforeach()
+
+          get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES)
+          foreach(_pro_include ${_inc_DIRS})
+              get_filename_component(_abs_include "${_pro_include}" ABSOLUTE)
+              set(_lst_file_srcs "-I${_pro_include}\n${_lst_file_srcs}")
+          endforeach()
+
           file(WRITE ${_ts_lst_file} "${_lst_file_srcs}")
         endif()
         add_custom_command(OUTPUT ${_ts_file}
index fd8db78..c11bf75 100644 (file)
@@ -16,6 +16,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
 
 set(my_srcs myi18nobject.cpp)
 
+include_directories("${CMAKE_CURRENT_SOURCE_DIR}/some_dir")
+
 qt5_create_translation(qm_files ${my_srcs} myobject_de.ts)
 
 add_executable(myobject ${my_srcs} ${qm_files})
index 0b79d78..f4287d8 100644 (file)
@@ -43,6 +43,8 @@
 #include <QCoreApplication>
 #include <QTranslator>
 
+#include "some_include.h"
+
 int main(int argc, char **argv)
 {
     QCoreApplication app(argc, argv);
diff --git a/tests/manual/cmake/pass2/some_dir/some_include.h b/tests/manual/cmake/pass2/some_dir/some_include.h
new file mode 100644 (file)
index 0000000..fcdacc8
--- /dev/null
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SOME_INCLUDE_H
+#define SOME_INCLUDE_H
+
+enum {
+  Non_Empty_File
+};
+
+#endif