Rex Dieter 3cbeae5
From 3d8aedab6319b38840dd65e97a09d403c629a5d1 Mon Sep 17 00:00:00 2001
Rex Dieter 3cbeae5
From: David Faure <faure@kde.org>
Rex Dieter 3cbeae5
Date: Sun, 26 Jul 2015 00:04:06 +0200
Rex Dieter 3cbeae5
Subject: [PATCH 6/7] Fix quoting problems with -D depending on required cmake
Rex Dieter 3cbeae5
 version
Rex Dieter 3cbeae5
Rex Dieter 3cbeae5
by using a generated header file instead. This is also nicer because
Rex Dieter 3cbeae5
changing the version will only recompile the one file that includes
Rex Dieter 3cbeae5
that header, instead of all.
Rex Dieter 3cbeae5
Rex Dieter 3cbeae5
cmake_minimum_required must be before project(), and should be 2.8.9
Rex Dieter 3cbeae5
to match kdelibs4's own files.
Rex Dieter 3cbeae5
---
Rex Dieter 3cbeae5
 CMakeLists.txt                   | 12 +++++-------
Rex Dieter 3cbeae5
 backends/xrandr/xrandrconfig.cpp |  1 +
Rex Dieter 3cbeae5
 libkscreen-version.h.in          |  1 +
Rex Dieter 3cbeae5
 3 files changed, 7 insertions(+), 7 deletions(-)
Rex Dieter 3cbeae5
 create mode 100644 libkscreen-version.h.in
Rex Dieter 3cbeae5
Rex Dieter 3cbeae5
diff --git a/CMakeLists.txt b/CMakeLists.txt
Rex Dieter 3cbeae5
index e703ad5..8cd18ca 100644
Rex Dieter 3cbeae5
--- a/CMakeLists.txt
Rex Dieter 3cbeae5
+++ b/CMakeLists.txt
Rex Dieter 3cbeae5
@@ -1,11 +1,9 @@
Rex Dieter 3cbeae5
+cmake_minimum_required(VERSION 2.8.9)
Rex Dieter 3cbeae5
 project(libkscreen)
Rex Dieter 3cbeae5
 set(libkscreen_VERSION_MAJOR 1)
Rex Dieter 3cbeae5
 set(libkscreen_VERSION_MINOR 0)
Rex Dieter 3cbeae5
 set(libkscreen_VERSION_RELEASE 5)
Rex Dieter 3cbeae5
 set(libkscreen_VERSION "${libkscreen_VERSION_MAJOR}.${libkscreen_VERSION_MINOR}.${libkscreen_VERSION_RELEASE}")
Rex Dieter 3cbeae5
-add_definitions("-DLIBKSCREEN_VERSION=\\\"${libkscreen_VERSION}\\\"")
Rex Dieter 3cbeae5
-
Rex Dieter 3cbeae5
-cmake_minimum_required(VERSION 2.8.0)
Rex Dieter 3cbeae5
Rex Dieter 3cbeae5
 if(POLICY CMP0017)
Rex Dieter 3cbeae5
   cmake_policy(SET CMP0017 NEW)
Rex Dieter 3cbeae5
@@ -61,15 +59,15 @@ set(INSTALL_TARGETS_DEFAULT_ARGS  RUNTIME DESTINATION "${BIN_INSTALL_DIR}"
Rex Dieter 3cbeae5
                                   ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" COMPONENT Devel )
Rex Dieter 3cbeae5
 
Rex Dieter 3cbeae5
 include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${QT_INCLUDES} ${KDE4_INCLUDES})
Rex Dieter 3cbeae5
+set(LIBKSCREEN_VERSION ${libkscreen_VERSION})
Rex Dieter 3cbeae5
+configure_file(${libkscreen_SOURCE_DIR}/libkscreen-version.h.in libkscreen-version.h @ONLY)
Rex Dieter 3cbeae5
 
Rex Dieter 3cbeae5
 add_subdirectory(src)
Rex Dieter 3cbeae5
 add_subdirectory(backends)
Rex Dieter 3cbeae5
 add_subdirectory(tests)
Rex Dieter 3cbeae5
 
Rex Dieter 3cbeae5
-configure_file(${libkscreen_SOURCE_DIR}/LibKScreenConfig.cmake.in
Rex Dieter 3cbeae5
-               ${libkscreen_BINARY_DIR}/LibKScreenConfig.cmake
Rex Dieter 3cbeae5
-               @ONLY
Rex Dieter 3cbeae5
-)
Rex Dieter 3cbeae5
+configure_file(${libkscreen_SOURCE_DIR}/LibKScreenConfig.cmake.in LibKScreenConfig.cmake @ONLY)
Rex Dieter 3cbeae5
+
Rex Dieter 3cbeae5
 # this file is used by to check if the installed version can be used.
Rex Dieter 3cbeae5
 macro_write_basic_cmake_version_file(${libkscreen_BINARY_DIR}/LibKScreenConfigVersion.cmake
Rex Dieter 3cbeae5
                                      ${libkscreen_VERSION_MAJOR} ${libkscreen_VERSION_MINOR} ${libkscreen_VERSION_RELEASE})
Rex Dieter 3cbeae5
diff --git a/backends/xrandr/xrandrconfig.cpp b/backends/xrandr/xrandrconfig.cpp
Rex Dieter 3cbeae5
index c75d5ea..683ac7a 100644
Rex Dieter 3cbeae5
--- a/backends/xrandr/xrandrconfig.cpp
Rex Dieter 3cbeae5
+++ b/backends/xrandr/xrandrconfig.cpp
Rex Dieter 3cbeae5
@@ -25,6 +25,7 @@
Rex Dieter 3cbeae5
 #include "config.h"
Rex Dieter 3cbeae5
 #include "output.h"
Rex Dieter 3cbeae5
 #include "edid.h"
Rex Dieter 3cbeae5
+#include <libkscreen-version.h>
Rex Dieter 3cbeae5
 
Rex Dieter 3cbeae5
 #include <QX11Info>
Rex Dieter 3cbeae5
 #include <QRect>
Rex Dieter 3cbeae5
diff --git a/libkscreen-version.h.in b/libkscreen-version.h.in
Rex Dieter 3cbeae5
new file mode 100644
Rex Dieter 3cbeae5
index 0000000..b2a9ca6
Rex Dieter 3cbeae5
--- /dev/null
Rex Dieter 3cbeae5
+++ b/libkscreen-version.h.in
Rex Dieter 3cbeae5
@@ -0,0 +1 @@
Rex Dieter 3cbeae5
+#cmakedefine LIBKSCREEN_VERSION "@LIBKSCREEN_VERSION@"
Rex Dieter 3cbeae5
-- 
Rex Dieter 3cbeae5
2.5.0
Rex Dieter 3cbeae5