|
Rex Dieter |
29094f |
From b873d2cb457503320e5f1d56d516e23eeb9ad7db Mon Sep 17 00:00:00 2001
|
|
Rex Dieter |
29094f |
From: Patrick Spendrin <ps_ml@gmx.de>
|
|
Rex Dieter |
29094f |
Date: Mon, 8 Nov 2010 18:12:50 +0100
|
|
Rex Dieter |
29094f |
Subject: [PATCH 27/33] add some changes to build automoc statically
|
|
Rex Dieter |
29094f |
|
|
Rex Dieter |
29094f |
---
|
|
Rex Dieter |
29094f |
CMakeLists.txt | 28 ++++++++++++++++++++++++++++
|
|
Rex Dieter |
29094f |
1 file changed, 28 insertions(+)
|
|
Rex Dieter |
29094f |
|
|
Rex Dieter |
29094f |
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
Rex Dieter |
29094f |
index 43e225a..2effd95 100644
|
|
Rex Dieter |
29094f |
--- a/CMakeLists.txt
|
|
Rex Dieter |
29094f |
+++ b/CMakeLists.txt
|
|
Rex Dieter |
29094f |
@@ -2,6 +2,13 @@ project(Automoc4)
|
|
Rex Dieter |
29094f |
|
|
Rex Dieter |
29094f |
cmake_minimum_required(VERSION 2.4.5 FATAL_ERROR)
|
|
Rex Dieter |
29094f |
|
|
Rex Dieter |
29094f |
+if(WIN32)
|
|
Rex Dieter |
29094f |
+ # make cmake 2.6 happy
|
|
Rex Dieter |
29094f |
+ if(COMMAND cmake_policy)
|
|
Rex Dieter |
29094f |
+ cmake_policy(SET CMP0003 NEW)
|
|
Rex Dieter |
29094f |
+ endif(COMMAND cmake_policy)
|
|
Rex Dieter |
29094f |
+endif(WIN32)
|
|
Rex Dieter |
29094f |
+
|
|
Rex Dieter |
29094f |
include(CTest)
|
|
Rex Dieter |
29094f |
|
|
Rex Dieter |
29094f |
find_package(Qt4 REQUIRED COMPONENTS QtCore )
|
|
Rex Dieter |
29094f |
@@ -19,6 +26,27 @@ include(Automoc4CPack.cmake)
|
|
Rex Dieter |
29094f |
|
|
Rex Dieter |
29094f |
configure_file(automoc4_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/automoc4_config.h)
|
|
Rex Dieter |
29094f |
|
|
Rex Dieter |
29094f |
+if(MSVC AND AUTOMOC_STATIC)
|
|
Rex Dieter |
29094f |
+ IF(EXISTS "${QT_MKSPECS_DIR}/default/qmake.conf")
|
|
Rex Dieter |
29094f |
+ FILE(READ "${QT_MKSPECS_DIR}/default/qmake.conf" _qmake_FILE_contents)
|
|
Rex Dieter |
29094f |
+ STRING(REGEX MATCH "QMAKE_CFLAGS_RELEASE[^\n]+" QMAKE_CFLAGS_RELEASE "${_qmake_FILE_contents}")
|
|
Rex Dieter |
29094f |
+ ENDIF(EXISTS "${QT_MKSPECS_DIR}/default/qmake.conf")
|
|
Rex Dieter |
29094f |
+
|
|
Rex Dieter |
29094f |
+ if (QMAKE_CFLAGS_RELEASE MATCHES ".*-MT.*")
|
|
Rex Dieter |
29094f |
+ MESSAGE(STATUS "Qt is build in static mode with static runtime - use static build mode with static runtime too")
|
|
Rex Dieter |
29094f |
+ set (MSVCRT_COMPILE_FLAGS "-MT /Os /Oy /GL")
|
|
Rex Dieter |
29094f |
+ set (MSVCRT_LINK_FLAGS "/NODEFAULTLIB:msvcrt")
|
|
Rex Dieter |
29094f |
+ else (QMAKE_CFLAGS_RELEASE MATCHES ".*-MT.*")
|
|
Rex Dieter |
29094f |
+ set (MSVCRT_COMPILE_FLAGS "-MD")
|
|
Rex Dieter |
29094f |
+ set (MSVCRT_LINK_FLAGS "")
|
|
Rex Dieter |
29094f |
+ MESSAGE(STATUS "Qt is build in static mode using shared runtime - use static build mode too")
|
|
Rex Dieter |
29094f |
+ endif (QMAKE_CFLAGS_RELEASE MATCHES ".*-MT.*")
|
|
Rex Dieter |
29094f |
+
|
|
Rex Dieter |
29094f |
+ set (CMAKE_C_FLAGS_RELEASE "${MSVCRT_COMPILE_FLAGS} /O2 /Ob2 /D NDEBUG")
|
|
Rex Dieter |
29094f |
+ set (CMAKE_CXX_FLAGS_RELEASE "${MSVCRT_COMPILE_FLAGS} /O2 /Ob2 /D NDEBUG")
|
|
Rex Dieter |
29094f |
+ set (CMAKE_EXE_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO ${MSVCRT_LINK_FLAGS}")
|
|
Rex Dieter |
29094f |
+endif(MSVC AND AUTOMOC_STATIC)
|
|
Rex Dieter |
29094f |
+
|
|
Rex Dieter |
29094f |
# Always include srcdir and builddir in include path
|
|
Rex Dieter |
29094f |
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
Rex Dieter |
29094f |
include_directories(${QT_INCLUDE_DIR})
|
|
Rex Dieter |
29094f |
--
|
|
Rex Dieter |
29094f |
2.4.3
|
|
Rex Dieter |
29094f |
|