From b73c6e6f7fe78e12e3ab3581c37f1af9d06f8339 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Tue, 20 Feb 2024 17:02:40 -0400 Subject: [PATCH] Install `FindJavaScriptCore.cmake` to simplify consumption Now we don't need clients to manually specify `CMAKE_MODULE_PATH` Signed-off-by: Juan Cruz Viotti --- config.cmake.in | 2 ++ src/engine/CMakeLists.txt | 8 ++++++++ test/packaging/find_package/CMakeLists.txt | 1 - 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config.cmake.in b/config.cmake.in index 0aeac31e..17dce9c9 100644 --- a/config.cmake.in +++ b/config.cmake.in @@ -7,6 +7,8 @@ if(NOT INCLUDEJS_COMPONENTS) list(APPEND INCLUDEJS_COMPONENTS engine) endif() +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") + foreach(component ${INCLUDEJS_COMPONENTS}) if(component STREQUAL "engine") include(CMakeFindDependencyMacro) diff --git a/src/engine/CMakeLists.txt b/src/engine/CMakeLists.txt index 46788890..5c66d03e 100644 --- a/src/engine/CMakeLists.txt +++ b/src/engine/CMakeLists.txt @@ -16,9 +16,17 @@ noa_library(PROJECT includejs NAME engine FOLDER "IncludeJS/Engine" PRIVATE_HEADERS context.h function.h error.h promise.h value.h SOURCES ${INCLUDEJS_ENGINE_SOURCES}) + if(INCLUDEJS_INSTALL) noa_library_install(PROJECT includejs NAME engine) + if(INCLUDEJS_BACKEND STREQUAL "JavaScriptCore") + install(FILES + "${PROJECT_SOURCE_DIR}/cmake/FindJavaScriptCore.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/includejs" + COMPONENT includejs_dev) + endif() endif() + sourcemeta_includejs_add_compile_options(includejs_engine) if(INCLUDEJS_BACKEND STREQUAL "JavaScriptCore") diff --git a/test/packaging/find_package/CMakeLists.txt b/test/packaging/find_package/CMakeLists.txt index 6e006ecd..a80d027e 100644 --- a/test/packaging/find_package/CMakeLists.txt +++ b/test/packaging/find_package/CMakeLists.txt @@ -3,7 +3,6 @@ project(includejs_hello VERSION 0.0.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../../cmake") find_package(IncludeJS REQUIRED) add_executable(includejs_hello hello.cc) target_link_libraries(includejs_hello PRIVATE includejs::engine)