Add the QtMain windows library to the CMake files.
Change-Id: Iff8b9bdd4b069721103e1cd5854e56b6116d7549 Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Alexander Neundorf <neundorf@kde.org> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
parent
3d763dc83a
commit
bd5096d012
@ -58,6 +58,15 @@ macx {
|
|||||||
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}$$eval(QT.$${MODULE}.MAJOR_VERSION).lib
|
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}$$eval(QT.$${MODULE}.MAJOR_VERSION).lib
|
||||||
}
|
}
|
||||||
CMAKE_BIN_SUFFIX = ".exe"
|
CMAKE_BIN_SUFFIX = ".exe"
|
||||||
|
|
||||||
|
CMAKE_WINDOWS_BUILD = "true"
|
||||||
|
win32-g++ {
|
||||||
|
CMAKE_WINMAIN_FILE_LOCATION_DEBUG = libqtmain$${QT_LIBINFIX}d.a
|
||||||
|
CMAKE_WINMAIN_FILE_LOCATION_RELEASE = libqtmain$${QT_LIBINFIX}.a
|
||||||
|
} else {
|
||||||
|
CMAKE_WINMAIN_FILE_LOCATION_DEBUG = qtmain$${QT_LIBINFIX}d.lib
|
||||||
|
CMAKE_WINMAIN_FILE_LOCATION_RELEASE = qtmain$${QT_LIBINFIX}.lib
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
!isEmpty(CMAKE_STATIC_TYPE) {
|
!isEmpty(CMAKE_STATIC_TYPE) {
|
||||||
CMAKE_LIB_FILE_LOCATION_DEBUG = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.a
|
CMAKE_LIB_FILE_LOCATION_DEBUG = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.a
|
||||||
|
@ -20,3 +20,26 @@ list(APPEND Qt5Core_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE)
|
|||||||
!!IF !isEmpty(QT_LIBINFIX)
|
!!IF !isEmpty(QT_LIBINFIX)
|
||||||
set(QT_LIBINFIX \"$${QT_LIBINFIX}\")
|
set(QT_LIBINFIX \"$${QT_LIBINFIX}\")
|
||||||
!!ENDIF
|
!!ENDIF
|
||||||
|
|
||||||
|
!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
|
||||||
|
set(Qt5Core_QTMAIN_LIBRARIES Qt5::WinMain)
|
||||||
|
|
||||||
|
if (NOT _Qt5WinMain_target)
|
||||||
|
set(_Qt5WinMain_target 1)
|
||||||
|
add_library(Qt5::WinMain STATIC IMPORTED)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
!!IF !isEmpty(debug_type)
|
||||||
|
set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||||
|
set_target_properties(Qt5::WinMain PROPERTIES
|
||||||
|
IMPORTED_LOCATION_DEBUG "${_qt5_install_prefix}/$$CMAKE_LIB_DIR/$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}"
|
||||||
|
)
|
||||||
|
!!ENDIF
|
||||||
|
|
||||||
|
!!IF !isEmpty(release_type)
|
||||||
|
set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||||
|
set_target_properties(Qt5::WinMain PROPERTIES
|
||||||
|
IMPORTED_LOCATION_RELEASE \"${_qt5_install_prefix}/$$CMAKE_LIB_DIR/$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\"
|
||||||
|
)
|
||||||
|
!!ENDIF
|
||||||
|
!!ENDIF
|
||||||
|
@ -88,3 +88,4 @@ expect_fail(fail4)
|
|||||||
expect_fail(fail5)
|
expect_fail(fail5)
|
||||||
expect_pass("pass(needsquoting)6")
|
expect_pass("pass(needsquoting)6")
|
||||||
expect_pass(pass7)
|
expect_pass(pass7)
|
||||||
|
expect_pass(pass8)
|
||||||
|
20
tests/manual/cmake/pass8/CMakeLists.txt
Normal file
20
tests/manual/cmake/pass8/CMakeLists.txt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
|
project(pass8)
|
||||||
|
|
||||||
|
find_package(Qt5Core REQUIRED)
|
||||||
|
|
||||||
|
include_directories(${Qt5Core_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
add_definitions(${Qt5Core_DEFINITIONS})
|
||||||
|
|
||||||
|
qt5_wrap_cpp(moc_files myobject.h)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
|
||||||
|
|
||||||
|
# On non-windows, the WIN32 is harmless, and Qt5Core_QTMAIN_LIBRARIES is empty.
|
||||||
|
# We test that it is harmless on those, and test that it builds on Windows.
|
||||||
|
# It wouldn't build if WIN32 is used and Qt5Core_QTMAIN_LIBRARIES is empty.
|
||||||
|
add_executable(myobject WIN32 myobject.cpp ${moc_files} )
|
||||||
|
target_link_libraries(myobject ${Qt5Core_LIBRARIES} ${Qt5Core_QTMAIN_LIBRARIES})
|
54
tests/manual/cmake/pass8/myobject.cpp
Normal file
54
tests/manual/cmake/pass8/myobject.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2012 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$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "myobject.h"
|
||||||
|
|
||||||
|
MyObject::MyObject(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
emit someSignal();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
MyObject myObject;
|
||||||
|
return 0;
|
||||||
|
}
|
57
tests/manual/cmake/pass8/myobject.h
Normal file
57
tests/manual/cmake/pass8/myobject.h
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2012 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 MYOBJECT_H
|
||||||
|
#define MYOBJECT_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class MyObject : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
MyObject(QObject *parent = 0);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void someSignal();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user