aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2019-05-12 22:20:56 +0200
committerCristian Adam <cristian.adam@gmail.com>2019-05-17 13:33:28 +0000
commitd855b84c5df923394ace3bb91dab379f7e0daa34 (patch)
treee184ccdf5724151465a1653f9fc308af43293de8 /cmake
parentf872a95fddd2690bb6953a17e48935c1b12d83d9 (diff)
Qt Creator CMake port
Based on Tobias Hunger's work from a few months ago. The CMake configuration needs libclang and Qt paths specified as CMAKE_PREFIX_PATH. Auto tests are run with "ctest". At the moment the pass rate is 87%. Change-Id: Iba98e39bf22077d52706dce6c85986be67a6eab0 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindDesignerComponents.cmake51
-rw-r--r--cmake/FindQbs.cmake55
2 files changed, 106 insertions, 0 deletions
diff --git a/cmake/FindDesignerComponents.cmake b/cmake/FindDesignerComponents.cmake
new file mode 100644
index 0000000000..551edf102d
--- /dev/null
+++ b/cmake/FindDesignerComponents.cmake
@@ -0,0 +1,51 @@
+#.rst:
+# FindDesignerComponents
+# ---------
+#
+# Try to locate the DesignerComponents library.
+# If found, this will define the following variables:
+#
+# ``DesignerComponents_FOUND``
+# True if the DesignerComponents library is available
+# ``DesignerComponents_INCLUDE_DIRS``
+# The DesignerComponents include directories
+# ``DesignerComponents_LIBRARIES``
+# The DesignerComponentscore library for linking
+# ``DesignerComponents_INSTALL_DIR``
+# Top level DesignerComponents installation directory
+#
+# If ``DesignerComponents_FOUND`` is TRUE, it will also define the following
+# imported target:
+#
+# ``Qt5::DesignerComponents``
+# The DesignerComponents library
+
+find_package(Qt5Designer QUIET)
+if (NOT Qt5Designer_FOUND)
+ set(DesignerComponents_FOUND OFF)
+ return()
+endif()
+
+
+find_path(DesignerComponents_INCLUDE_DIRS NAMES qtdesignercomponentsversion.h PATH_SUFFIXES QtDesignerComponents HINTS ${Qt5Designer_INCLUDE_DIRS})
+
+find_library(DesignerComponents_LIBRARIES NAMES Qt5DesignerComponents)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(DesignerComponents DEFAULT_MSG
+ DesignerComponents_LIBRARIES DesignerComponents_INCLUDE_DIRS)
+
+if(DesignerComponents_FOUND AND NOT TARGET DesignerComponents::DesignerComponents)
+ add_library(Qt5::DesignerComponents UNKNOWN IMPORTED)
+ set_target_properties(Qt5::DesignerComponents PROPERTIES
+ IMPORTED_LOCATION "${DesignerComponents_LIBRARIES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${DesignerComponents_INCLUDE_DIRS}")
+endif()
+
+mark_as_advanced(DesignerComponents_INCLUDE_DIRS DesignerComponents_LIBRARIES)
+
+include(FeatureSummary)
+set_package_properties(DesignerComponents PROPERTIES
+ URL "https://qt.io/"
+ DESCRIPTION "Qt5 (Widget) DesignerComponents library")
+
diff --git a/cmake/FindQbs.cmake b/cmake/FindQbs.cmake
new file mode 100644
index 0000000000..f89252cf86
--- /dev/null
+++ b/cmake/FindQbs.cmake
@@ -0,0 +1,55 @@
+#.rst:
+# FindQbs
+# ---------
+#
+# Try to locate the Qbs library.
+# If found, this will define the following variables:
+#
+# ``QBS_FOUND``
+# True if the qbs library is available
+# ``QBS_INCLUDE_DIRS``
+# The qbs include directories
+# ``QBSCORE_LIBRARIES``
+# The qbscore library for linking
+# ``QBS_INSTALL_DIR``
+# Top level qbs installation directory
+#
+# If ``QBS_FOUND`` is TRUE, it will also define the following
+# imported target:
+#
+# ``QBS::QBS``
+# The qbs library
+
+find_program(QBS_BINARY NAMES qbs)
+if(QBS_BINARY STREQUAL "QBS_BINARY-NOTFOUND")
+ set(_QBS_INSTALL_DIR "QBS_INSTALL_DIR-NOTFOUND")
+else()
+ get_filename_component(_QBS_BIN_DIR "${QBS_BINARY}" DIRECTORY)
+ get_filename_component(_QBS_INSTALL_DIR "${_QBS_BIN_DIR}" DIRECTORY)
+endif()
+
+set(QBS_INSTALL_DIR "${_QBS_INSTALL_DIR}" CACHE PATH "Qbs install directory")
+
+find_path(QBS_INCLUDE_DIRS NAMES qbs.h PATH_SUFFIXES qbs HINTS "${QBS_INSTALL_DIR}/include")
+
+find_library(QBSCORE_LIBRARIES NAMES qbscore HINTS "${QBS_INSTALL_DIR}/lib")
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(QBS DEFAULT_MSG QBSCORE_LIBRARIES QBS_INCLUDE_DIRS)
+
+if(QBS_FOUND AND NOT TARGET Qbs::QbsCore)
+ add_library(Qbs::QbsCore UNKNOWN IMPORTED)
+ # FIXME: Detect whether QBS_ENABLE_PROJECT_FILE_UPDATES is set in qbscore!
+ set_target_properties(Qbs::QbsCore PROPERTIES
+ IMPORTED_LOCATION "${QBSCORE_LIBRARIES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${QBS_INCLUDE_DIRS}"
+ INTERFACE_COMPILE_DEFINITIONS "QBS_ENABLE_PROJECT_FILE_UPDATES")
+endif()
+
+mark_as_advanced(QBS_INCLUDE_DIRS QBSCORE_LIBRARIES QBS_INSTALL_DIR)
+
+include(FeatureSummary)
+set_package_properties(QBS PROPERTIES
+ URL "https://qt.io/qbs"
+ DESCRIPTION "QBS build system")
+