[Ktutorial-commits] SF.net SVN: ktutorial:[369] trunk/ktutorial/ktutorial-library
Status: Alpha
Brought to you by:
danxuliu
|
From: <dan...@us...> - 2012-08-14 22:34:59
|
Revision: 369
http://ktutorial.svn.sourceforge.net/ktutorial/?rev=369&view=rev
Author: danxuliu
Date: 2012-08-14 22:34:53 +0000 (Tue, 14 Aug 2012)
Log Message:
-----------
Add KTutorial version support for FindKTutorial.cmake.
Modified Paths:
--------------
trunk/ktutorial/ktutorial-library/CMakeLists.txt
trunk/ktutorial/ktutorial-library/cmake/modules/FindKTutorial.cmake
trunk/ktutorial/ktutorial-library/src/CMakeLists.txt
Added Paths:
-----------
trunk/ktutorial/ktutorial-library/src/version.h.cmake
Modified: trunk/ktutorial/ktutorial-library/CMakeLists.txt
===================================================================
--- trunk/ktutorial/ktutorial-library/CMakeLists.txt 2012-08-11 01:33:20 UTC (rev 368)
+++ trunk/ktutorial/ktutorial-library/CMakeLists.txt 2012-08-14 22:34:53 UTC (rev 369)
@@ -3,6 +3,12 @@
set(QT_MIN_VERSION "4.6")
find_package(KDE4 REQUIRED)
+####### KTutorial version #######
+set(CMAKE_KTUTORIAL_VERSION_MAJOR 0)
+set(CMAKE_KTUTORIAL_VERSION_MINOR 4)
+set(CMAKE_KTUTORIAL_VERSION_RELEASE 98)
+set(CMAKE_KTUTORIAL_VERSION_STRING "${CMAKE_KTUTORIAL_VERSION_MAJOR}.${CMAKE_KTUTORIAL_VERSION_MINOR}.${CMAKE_KTUTORIAL_VERSION_RELEASE}")
+
enable_testing()
add_subdirectory(cmake)
Modified: trunk/ktutorial/ktutorial-library/cmake/modules/FindKTutorial.cmake
===================================================================
--- trunk/ktutorial/ktutorial-library/cmake/modules/FindKTutorial.cmake 2012-08-11 01:33:20 UTC (rev 368)
+++ trunk/ktutorial/ktutorial-library/cmake/modules/FindKTutorial.cmake 2012-08-14 22:34:53 UTC (rev 369)
@@ -4,11 +4,12 @@
# KTUTORIAL_FOUND - system has KTutorial
# KTUTORIAL_INCLUDE_DIRS - the KTutorial include directories
# KTUTORIAL_LIBRARIES - link these to use KTutorial
+# KTUTORIAL_VERSION - the KTutorial version (string value)
#
# KTUTORIAL_INCLUDE_DIR - where to find ktutorial/KTutorial.h, etc
# KTUTORIAL_LIBRARY - the KTutorial library
#
-# Copyright (c) 2010 Daniel Calviño Sánchez <dan...@gm...>
+# Copyright (c) 2010-2012 Daniel Calviño Sánchez <dan...@gm...>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
@@ -23,8 +24,18 @@
PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR}
)
+if(KTUTORIAL_INCLUDE_DIR)
+ file(READ ${KTUTORIAL_INCLUDE_DIR}/ktutorial/version.h KTUTORIAL_VERSION_CONTENT)
+ string(REGEX MATCH "KTUTORIAL_VERSION_STRING \"(.*)\"\n" KTUTORIAL_VERSION_MATCH "${KTUTORIAL_VERSION_CONTENT}")
+ if(KTUTORIAL_VERSION_MATCH)
+ set(KTUTORIAL_VERSION "${CMAKE_MATCH_1}")
+ endif(KTUTORIAL_VERSION_MATCH)
+endif(KTUTORIAL_INCLUDE_DIR)
+
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(KTutorial DEFAULT_MSG KTUTORIAL_LIBRARY KTUTORIAL_INCLUDE_DIR)
+find_package_handle_standard_args(KTutorial REQUIRED_VARS KTUTORIAL_LIBRARY KTUTORIAL_INCLUDE_DIR
+ VERSION_VAR KTUTORIAL_VERSION
+)
if(KTUTORIAL_FOUND)
set(KTUTORIAL_INCLUDE_DIRS ${KTUTORIAL_INCLUDE_DIR})
Modified: trunk/ktutorial/ktutorial-library/src/CMakeLists.txt
===================================================================
--- trunk/ktutorial/ktutorial-library/src/CMakeLists.txt 2012-08-11 01:33:20 UTC (rev 368)
+++ trunk/ktutorial/ktutorial-library/src/CMakeLists.txt 2012-08-14 22:34:53 UTC (rev 369)
@@ -13,6 +13,9 @@
add_subdirectory(editorsupport)
endif (QT_QTDBUS_FOUND)
+# version.h is used by FindKTutorial.cmake
+configure_file(version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h)
+
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${KDE4_INCLUDES})
set(ktutorial_LIB_SRCS
@@ -66,12 +69,14 @@
WaitForSignal.h
WaitForStepActivation.h
WaitForWindow.h
+ ${CMAKE_CURRENT_BINARY_DIR}/version.h
)
# Hack to make headers available to other ktutorial modules (like
# ktutorial-test-app) when the library is built but not installed yet.
foreach(header ${ktutorial_LIB_HEADERS})
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${header} ${ktutorial-library_BINARY_DIR}/includes/ktutorial/${header} COPYONLY)
+ get_filename_component(headerName ${header} NAME)
+ configure_file(${header} ${ktutorial-library_BINARY_DIR}/includes/ktutorial/${headerName} COPYONLY)
endforeach(header)
install(FILES ${ktutorial_LIB_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/ktutorial)
Added: trunk/ktutorial/ktutorial-library/src/version.h.cmake
===================================================================
--- trunk/ktutorial/ktutorial-library/src/version.h.cmake (rev 0)
+++ trunk/ktutorial/ktutorial-library/src/version.h.cmake 2012-08-14 22:34:53 UTC (rev 369)
@@ -0,0 +1,30 @@
+/***************************************************************************
+ * Copyright (C) 2012 by Daniel Calviño Sánchez *
+ * dan...@gm... *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; If not, see <http://www.gnu.org/licenses/>. *
+ ***************************************************************************/
+
+#ifndef KTUTORIAL_VERSION_H
+#define KTUTORIAL_VERSION_H
+
+#define KTUTORIAL_VERSION_STRING "${CMAKE_KTUTORIAL_VERSION_STRING}"
+
+#define KTUTORIAL_VERSION_MAJOR ${CMAKE_KTUTORIAL_VERSION_MAJOR}
+
+#define KTUTORIAL_VERSION_MINOR ${CMAKE_KTUTORIAL_VERSION_MINOR}
+
+#define KTUTORIAL_VERSION_RELEASE ${CMAKE_KTUTORIAL_VERSION_RELEASE}
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|