aboutsummaryrefslogtreecommitdiff
path: root/scripts/cmake/vcpkg_configure_qmake.cmake
blob: 037197e483b9b5765c1e633de7034cbd3216d282 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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_build_qmake
#  command. 
#
#  ::
#  vcpkg_configure_qmake(SOURCE_PATH <pro_file_path>
#                        [OPTIONS arg1 [arg2 ...]]
#                        )
#
#  ``SOURCE_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.exe PATHS ${CURRENT_INSTALLED_DIR}/tools/qt5)
    
    if(NOT QMAKE_COMMAND)
        message(FATAL_ERROR "vcpkg_configure_qmake: unable 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_OPTIONS} -d ${_csc_SOURCE_PATH}
        WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}
        LOGNAME config-${TARGET_TRIPLET}
    )
    message(STATUS "Configuring ${TARGET_TRIPLET} done")
endfunction()