From 34ebd0397e4d3fe708780356cded7d85f3dae259 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 17 Dec 2011 00:47:13 +0100 Subject: [PATCH] Fix cmake files for static builds. Change-Id: I3864017df6fc0daeb31b389c8883401d344730bf Reviewed-by: Alexander Neundorf Reviewed-by: Stephen Kelly --- mkspecs/cmake/Qt5BasicConfig.cmake.in | 6 +++++- mkspecs/features/create_cmake.prf | 33 +++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/mkspecs/cmake/Qt5BasicConfig.cmake.in b/mkspecs/cmake/Qt5BasicConfig.cmake.in index 55f7909..2c8cd17 100644 --- a/mkspecs/cmake/Qt5BasicConfig.cmake.in +++ b/mkspecs/cmake/Qt5BasicConfig.cmake.in @@ -16,7 +16,11 @@ set(_Qt5_MODULE_DEPENDENCIES \"$${CMAKE_MODULE_DEPS}\") if (NOT _Qt5$${CMAKE_MODULE_NAME}_target) set(_Qt5$${CMAKE_MODULE_NAME}_target 1) - add_library(Qt5::$${CMAKE_MODULE_NAME} SHARED IMPORTED) + if (\"$${CMAKE_STATIC_TYPE}\" STREQUAL \"\") + add_library(Qt5::$${CMAKE_MODULE_NAME} SHARED IMPORTED) + else() + add_library(Qt5::$${CMAKE_MODULE_NAME} STATIC IMPORTED) + endif() if (NOT \"$${CMAKE_BUILD_IS_FRAMEWORK}\" STREQUAL \"\") set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY FRAMEWORK 1) endif() diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf index 7f2a344..0a14b5c 100644 --- a/mkspecs/features/create_cmake.prf +++ b/mkspecs/features/create_cmake.prf @@ -35,18 +35,33 @@ macx { CMAKE_LIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.framework/Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX} CMAKE_BUILD_IS_FRAMEWORK = "true" } else { - CMAKE_LIB_FILE_LOCATION_DEBUG = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.$$eval(QT.$${MODULE}.VERSION).dylib - CMAKE_LIB_FILE_LOCATION_RELEASE = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.$$eval(QT.$${MODULE}.VERSION).dylib + static { + CMAKE_LIB_FILE_LOCATION_DEBUG = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.a + CMAKE_LIB_FILE_LOCATION_RELEASE = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.a + } else { + CMAKE_LIB_FILE_LOCATION_DEBUG = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.$$eval(QT.$${MODULE}.VERSION).dylib + CMAKE_LIB_FILE_LOCATION_RELEASE = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.$$eval(QT.$${MODULE}.VERSION).dylib + } } } else:win32 { - CMAKE_LIB_FILE_LOCATION_DEBUG = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}d$$eval(QT.$${MODULE}.MAJOR_VERSION).dll - CMAKE_LIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}$$eval(QT.$${MODULE}.MAJOR_VERSION).dll - CMAKE_IMPLIB_FILE_LOCATION_DEBUG = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}d$$eval(QT.$${MODULE}.MAJOR_VERSION).lib - CMAKE_IMPLIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}$$eval(QT.$${MODULE}.MAJOR_VERSION).lib + static { + CMAKE_IMPLIB_FILE_LOCATION_DEBUG = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}d.lib + CMAKE_IMPLIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.lib + } else { + CMAKE_LIB_FILE_LOCATION_DEBUG = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}d$$eval(QT.$${MODULE}.MAJOR_VERSION).dll + CMAKE_LIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}$$eval(QT.$${MODULE}.MAJOR_VERSION).dll + CMAKE_IMPLIB_FILE_LOCATION_DEBUG = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}d$$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" } else { - CMAKE_LIB_FILE_LOCATION_DEBUG = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.so.$$eval(QT.$${MODULE}.VERSION) - CMAKE_LIB_FILE_LOCATION_RELEASE = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.so.$$eval(QT.$${MODULE}.VERSION) + static { + CMAKE_LIB_FILE_LOCATION_DEBUG = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.a + CMAKE_LIB_FILE_LOCATION_RELEASE = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.a + } else { + CMAKE_LIB_FILE_LOCATION_DEBUG = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.so.$$eval(QT.$${MODULE}.VERSION) + CMAKE_LIB_FILE_LOCATION_RELEASE = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.so.$$eval(QT.$${MODULE}.VERSION) + } } debug_type = @@ -57,6 +72,8 @@ debug_and_release|release:release_type = release INSTALLS += cmake_qt5_module_files +static:CMAKE_STATIC_TYPE = true + cmake_config_file.input = $$PWD/../cmake/Qt5BasicConfig.cmake.in cmake_config_file.output = $$eval(QT.$${MODULE}.libs)/cmake/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}Config.cmake -- 2.7.4