ladybird/Meta/CMake/lagom-install-config.cmake.in
Andrew Kaster ca42da23c2 Meta+Userland: Add jakt as an optional Lagom Tool
We can now use ENABLE_JAKT to pull jakt as a host tool and use it to
pre-process .jakt files into .cpp files for use in serenity applications
2022-05-23 23:05:45 +02:00

31 lines
1.2 KiB
CMake

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()