aboutsummaryrefslogtreecommitdiff
path: root/scripts/cmake/vcpkg_install_qmake.cmake
blob: d8362697abc762e1df123368e802bb395442a5f5 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#[===[.md:
# vcpkg_install_qmake

Build and install a qmake project.

## Usage:
```cmake
vcpkg_install_qmake(...)
```

## Parameters:
See [`vcpkg_build_qmake()`](vcpkg_build_qmake.md).

## Notes:
This command transparently forwards to [`vcpkg_build_qmake()`](vcpkg_build_qmake.md).

Additionally, this command will copy produced .libs/.dlls/.as/.dylibs/.sos to the appropriate
staging directories.

## Examples

* [libqglviewer](https://github.com/Microsoft/vcpkg/blob/master/ports/libqglviewer/portfile.cmake)
#]===]

function(vcpkg_install_qmake)
    vcpkg_build_qmake(${ARGN})
    file(GLOB_RECURSE RELEASE_LIBS
        ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.lib
        ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.a
        ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.so
        ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.so.*
        ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.dylib
    )
    file(GLOB_RECURSE RELEASE_BINS
        ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.dll
    )
    file(GLOB_RECURSE DEBUG_LIBS
        ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.lib
        ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.a
        ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.so
        ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.so.*
        ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.dylib
    )
    file(GLOB_RECURSE DEBUG_BINS
        ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.dll
    )
    if(NOT RELEASE_LIBS AND NOT DEBUG_LIBS)
        message(FATAL_ERROR "Build did not appear to produce any libraries. If this is intended, use `vcpkg_build_qmake()` directly.")
    endif()
    if(RELEASE_LIBS)
        file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib)
        file(COPY ${RELEASE_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
    endif()
    if(DEBUG_LIBS)
        file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib)
        file(COPY ${DEBUG_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
    endif()
    if(RELEASE_BINS)
        file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
        file(COPY ${RELEASE_BINS} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
    endif()
    if(DEBUG_BINS)
        file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
        file(COPY ${DEBUG_BINS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
    endif()
endfunction()