You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
phonon/0007-remove-automoc4-depend...

58 lines
2.4 KiB

From 18223bd2f2dcc354127dd9cffc5a80f5c4cdadeb Mon Sep 17 00:00:00 2001
From: Harald Sitter <sitter@kde.org>
Date: Wed, 12 Sep 2012 18:10:13 +0200
Subject: [PATCH 07/12] remove automoc4 dependency
Starting with CMake 2.8.6 there is an automoc builtin. Whenever using
CMake >= 2.8.6 we therefore activate the builtin and provide a
compatibility macro for automoc4_add_library. When using < 2.8.6 we
continue to look for automoc4 and fail if unable to find it.
This makes the automoc4 dep unnecessary when building with a sufficiently
new CMake version. Horray!
---
cmake/FindPhononInternal.cmake | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/cmake/FindPhononInternal.cmake b/cmake/FindPhononInternal.cmake
index 2bad949..1e9edb0 100644
--- a/cmake/FindPhononInternal.cmake
+++ b/cmake/FindPhononInternal.cmake
@@ -74,14 +74,25 @@ endif(NOT QT_QTDBUS_FOUND)
# - Automoc
-find_package(Automoc4 REQUIRED)
-if (NOT AUTOMOC4_VERSION)
- set(AUTOMOC4_VERSION "0.9.83")
-endif (NOT AUTOMOC4_VERSION)
-macro_ensure_version("0.9.86" "${AUTOMOC4_VERSION}" _automoc4_version_ok)
-if (NOT _automoc4_version_ok)
- message(FATAL_ERROR "Your version of automoc4 is too old. You have ${AUTOMOC4_VERSION}, you need at least 0.9.86")
-endif (NOT _automoc4_version_ok)
+# Starting with CMake 2.8.6 there is a builtin to replace automoc4, use that when possible.
+if(CMAKE_VERSION VERSION_GREATER 2.8.5)
+ message(STATUS "Using CMake automoc builtin")
+ set(CMAKE_AUTOMOC TRUE)
+ # Compatiblity Macro
+ macro(AUTOMOC4_ADD_LIBRARY _target_NAME _add_executable_param)
+ add_library(${_target_NAME} ${_add_executable_param} ${ARGN})
+ endmacro(AUTOMOC4_ADD_LIBRARY)
+else(CMAKE_VERSION VERSION_GREATER 2.8.5)
+ message(STATUS "Can not use CMake automoc builtin, trying to find automoc4")
+ find_package(Automoc4 REQUIRED)
+ if (NOT AUTOMOC4_VERSION)
+ set(AUTOMOC4_VERSION "0.9.83")
+ endif (NOT AUTOMOC4_VERSION)
+ macro_ensure_version("0.9.86" "${AUTOMOC4_VERSION}" _automoc4_version_ok)
+ if (NOT _automoc4_version_ok)
+ message(FATAL_ERROR "Your version of automoc4 is too old. You have ${AUTOMOC4_VERSION}, you need at least 0.9.86")
+ endif (NOT _automoc4_version_ok)
+endif(CMAKE_VERSION VERSION_GREATER 2.8.5)
# restore the original CMAKE_MODULE_PATH
set(CMAKE_MODULE_PATH ${_phonon_cmake_module_path_back})
--
1.8.3.1