From a59ba0e3eda5381623a4929486b2f673a883d8d8 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Tue, 20 Oct 2026 01:29:21 +0800 Subject: [CMake] Add compiler options and target helpers --- cfront/cmake/modules/AddCFront.cmake | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 cfront/cmake/modules/AddCFront.cmake (limited to 'cfront') diff --git a/cfront/cmake/modules/AddCFront.cmake b/cfront/cmake/modules/AddCFront.cmake new file mode 100644 index 0000000..50ba9f9 --- /dev/null +++ b/cfront/cmake/modules/AddCFront.cmake @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +include_guard(GLOBAL) +include(AddRCC) + +function(add_cfront_library name) + cmake_parse_arguments(PARSE_ARGV 1 arg "DISABLE_PCH_REUSE;NO_INSTALL_RPATH" "" "LINK_LIBS;PRECOMPILE_HEADERS") + add_library(${name} ${arg_UNPARSED_ARGUMENTS}) + target_link_libraries(${name} PUBLIC CFrontHeaders ${arg_LINK_LIBS}) + rcc_configure_target(${name}) + install(TARGETS ${name} EXPORT CFrontTargets + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +endfunction() + +function(add_cfront_tool name) + add_rcc_executable(${name} ${ARGN}) + target_link_libraries(${name} PRIVATE CFrontHeaders) + install(TARGETS ${name} EXPORT CFrontTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +endfunction() -- cgit v1.2.3