summaryrefslogtreecommitdiff
path: root/Meta/CMake/lagom-install-config.cmake.in
blob: 8842161ca9b3da66bd46c5105fd417a78507e937 (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
include("${CMAKE_CURRENT_LIST_DIR}/LagomTargets.cmake")

if (@ENABLE_JAKT@)
    # FIXME: corrosion does not support corrosion_install(TARGETS  <targets>... EXPORT <export-name>)
    #        Instead, hack up the magic sauce using the imported location of IPCCompiler

    # Create imported target Lagom::jakt
    add_executable(Lagom::jakt IMPORTED)

    # Figure out where the binary directory of the install tree is
    get_property(_IMPORTED_BINDIR
        TARGET Lagom::IPCCompiler
        PROPERTY LOCATION
    )
    get_filename_component(_IMPORTED_BINDIR "${_IMPORTED_BINDIR}" DIRECTORY)
    get_filename_component(_IMPORTED_INCLUDEDIR "${_IMPORTED_BINDIR}" DIRECTORY)
    set(_IMPORTED_INCLUDEDIR "${_IMPORTED_INCLUDEDIR}/include")

    # Set the imported location of the tool
    set_target_properties(Lagom::jakt PROPERTIES
        IMPORTED_LOCATION "${_IMPORTED_BINDIR}/jakt"
        IMPORTED_INCLUDE_DIRECTORIES "${_IMPORTED_INCLUDEDIR}/jakt"
    )

    if (NOT EXISTS "${_IMPORTED_BINDIR}/jakt")
        message(FATAL_ERROR "The imported target \"jakt\" references the file \"${_IMPORTED_BINDIR}/jakt\" but this file does not exist.")
    endif()

    unset(_IMPORTED_BINDIR)
    unset(_IMPORTED_INCLUDEDIR)
endif()