Commit [r6201] Maximize Restore History

cmake build reworked: qore creates cmake support files during configuration; modules using cmake just do not use FindQore.cmake in internal trees but use system-wide QoreConfig.cmake

subik 2014-01-02

added /qore/trunk/cmake/QoreMacros.cmake
added /qore/trunk/cmake/QoreConfigVersion.cmake.in
removed /module-sysconf/trunk/cmake/FindQore.cmake
removed /module-linenoise/trunk/cmake/FindQore.cmake
removed /module-qt4/branches/smoke-split/cmake/modules/FindQore.cmake
removed /module-fsevent/trunk/cmake/FindQore.cmake
removed /module-magic/trunk/cmake/FindQore.cmake
removed /module-qt4/trunk/cmake/modules/FindQore.cmake
removed /module-dummy/trunk/cmake/modules/FindQore.cmake
changed /qore/trunk/Makefile.am
changed /qore/trunk/configure.ac
copied /module-qt/trunk/tools/cmake/modules/FindQore.cmake -> /qore/trunk/cmake/QoreConfig.cmake.in
/qore/trunk/cmake/QoreMacros.cmake Diff Switch to side-by-side view
Loading...
/qore/trunk/cmake/QoreConfigVersion.cmake.in Diff Switch to side-by-side view
Loading...
/qore/trunk/Makefile.am Diff Switch to side-by-side view
Loading...
/qore/trunk/configure.ac Diff Switch to side-by-side view
Loading...
/module-qt/trunk/tools/cmake/modules/FindQore.cmake to /qore/trunk/cmake/QoreConfig.cmake.in
--- a/module-qt/trunk/tools/cmake/modules/FindQore.cmake
+++ b/qore/trunk/cmake/QoreConfig.cmake.in
@@ -1,49 +1,45 @@
-#
-# Cmake module for Qore programming language
-#
-# (c) 2009 Qore Technologies, http://qoretechnologies.com
-#
-# QORE_FOUND - system has it
-# QORE_INCLUDE_DIR 
-# QORE_LIBRARY
-# QORE_MODULES_DIR
 
-SET(QORE_FOUND FALSE)
+if (CMAKE_VERSION VERSION_LESS 2.8.3)
+    message(FATAL_ERROR "Qore requires at least CMake version 2.8.3")
+endif()
 
 
-FIND_PATH (QORE_INCLUDE_DIR qore/Qore.h
-    /usr/include
-    /usr/include/qore
-    /opt/qore/include/qore
-    /opt/qore/include
-    ${QORE_INCLUDE_PATH}
-)
 
-FIND_LIBRARY (QORE_LIBRARY
-    NAMES libqore libqore.so libqore.dylib
-    PATHS /usr/local/lib
-	  /usr/lib
-	  /opt/qore/lib
-	  ${QORE_LIBRARY_PATH}
-    )
-
-IF (QORE_LIBRARY AND QORE_INCLUDE_DIR)
-    SET(QORE_LIBRARIES ${QORE_LIBRARY})
-    SET(QORE_FOUND TRUE)
-ENDIF (QORE_LIBRARY AND QORE_INCLUDE_DIR)
+# QORE_FOUND - system has qore installed
+# QORE_INCLUDE_DIR - includes
+# QORE_INCLUDE_DIRS - cmake standar alias for QORE_INCLUDE_DIR
+# QORE_LIBRARY - library location
+# QORE_LIBRARIES - cmake standard alias for QORE_LIBRARY
+#
+# QORE_MODULES_DIR - location of qore modules
+# QORE_API_VERSION - API version
+#
+# QORE_EXECUTABLE - qore interpret executable
+# QORE_QPP_EXECUTABLE - qore qpp executable
 
 
-IF (QORE_FOUND)
-    MESSAGE(STATUS "Found Qore lib: ${QORE_LIBRARY}")
-    MESSAGE(STATUS "      includes: ${QORE_INCLUDE_DIR}")
-ELSE (QORE_FOUND)
-    MESSAGE(STATUS "E! Found Qore lib: ${QORE_LIBRARY}")
-    MESSAGE(STATUS "E!      includes: ${QORE_INCLUDE_DIR}")
+# get Qore version form 'qore --short-version' command etc
+FIND_PROGRAM(QORE_EXECUTABLE NAMES qore DOC "Searching for qore executable")
+IF (NOT QORE_EXECUTABLE)
+    MESSAGE( FATAL_ERROR "Cannot find 'qore' executable. Check if it's in your PATH" )
+ENDIF (NOT QORE_EXECUTABLE)
 
-  IF (Qore_FIND_REQUIRED)
-    MESSAGE(FATAL_ERROR "Could not find Qore library")
-  ENDIF (Qore_FIND_REQUIRED)
-ENDIF (QORE_FOUND)
+FIND_PROGRAM(QORE_QPP_EXECUTABLE NAMES qpp DOC "Searching for qore qpp preprocessor")
+IF (NOT QORE_QPP_EXECUTABLE)
+    MESSAGE( FATAL_ERROR "Cannot find 'qpp' executable. Check if it's in your PATH" )
+ENDIF (NOT QORE_QPP_EXECUTABLE)
 
-MARK_AS_ADVANCED(QORE_INCLUDE_DIR QORE_LIBRARY)
+include("${CMAKE_CURRENT_LIST_DIR}/QoreMacros.cmake")
 
+
+set(QORE_FOUND 1)
+
+set(QORE_INCLUDE_DIR @myprefix@/include)
+set(QORE_INCLUDE_DIRS ${QORE_INCLUDE_DIR})
+
+find_library(QORE_LIBRARY NAMES qore libqore HINTS "@myprefix@/lib@LIBSUFFIX@/")
+set(QORE_LIBRARIES ${QORE_LIBRARY})
+
+set(QORE_MODULES_DIR @MODULE_DIR@)
+set(QORE_API_VERSION @MODULE_API_MAJOR@.@MODULE_API_MINOR@)
+