aboutsummaryrefslogtreecommitdiff
path: root/scripts/cmake/vcpkg_configure_qmake.cmake
diff options
context:
space:
mode:
authorSilvio <silvio.traversaro@iit.it>2017-01-05 23:38:01 +0100
committerSilvio <silvio.traversaro@iit.it>2017-01-05 23:46:43 +0100
commit1decb1b52c023cc56e475ea05ec533ae65ce3c8a (patch)
tree94aaf14b8c8b58d828e78fa57e54553467741c83 /scripts/cmake/vcpkg_configure_qmake.cmake
parentf4c34bb42dd0fe8217d4d54a9a4a2eeecdb0f0f4 (diff)
downloadvcpkg-1decb1b52c023cc56e475ea05ec533ae65ce3c8a.tar.gz
vcpkg-1decb1b52c023cc56e475ea05ec533ae65ce3c8a.zip
cmake: add qmake-related helpers function
Diffstat (limited to 'scripts/cmake/vcpkg_configure_qmake.cmake')
-rw-r--r--scripts/cmake/vcpkg_configure_qmake.cmake44
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/cmake/vcpkg_configure_qmake.cmake b/scripts/cmake/vcpkg_configure_qmake.cmake
new file mode 100644
index 000000000..f51a2f4fb
--- /dev/null
+++ b/scripts/cmake/vcpkg_configure_qmake.cmake
@@ -0,0 +1,44 @@
+#.rst:
+# .. command:: vcpkg_configure_qmake
+#
+# Configure a qmake-based project.
+# It is assume that the qmake project CONFIG variable is
+# "debug_and_release" (the default value on Windows, see [1]).
+# Using this option, only one Makefile for building both Release and Debug
+# libraries is generated, that then can be run using the vcpkg_install_qmake
+# command.
+#
+# ::
+# vcpkg_configure_qmake(SOURCE_PATH <pro_file_path>
+# [OPTIONS arg1 [arg2 ...]]
+# )
+#
+# ``PROJECT_PATH``
+# The path to the *.pro qmake project file.
+# ``OPTIONS``
+# The options passed to qmake.
+#
+# [1] : http://doc.qt.io/qt-5/qmake-variable-reference.html
+
+function(vcpkg_configure_qmake)
+ cmake_parse_arguments(_csc "" "SOURCE_PATH" "OPTIONS" ${ARGN})
+
+ # Find qmake exectuable
+ find_program(QMAKE_COMMAND NAMES qmake)
+
+ if(NOT QMAKE_COMMAND)
+ BUILD_ERROR("vcpkg_configure_qmake: impossible to find qmake.")
+ endif()
+
+ # Cleanup build directories
+ file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
+
+ message(STATUS "Configuring ${TARGET_TRIPLET}")
+ file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
+ vcpkg_execute_required_process(
+ COMMAND ${QMAKE_COMMAND} ${_csc_SOURCE_PATH} ${_csc_OPTIONS}
+ WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}
+ LOGNAME config-${TARGET_TRIPLET}
+ )
+ message(STATUS "Configuring ${TARGET_TRIPLET} done")
+endfunction() \ No newline at end of file