Skip to content

Commit

Permalink
Install FindJavaScriptCore.cmake to simplify consumption
Browse files Browse the repository at this point in the history
Now we don't need clients to manually specify `CMAKE_MODULE_PATH`

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
  • Loading branch information
jviotti committed Feb 20, 2024
1 parent dc630bc commit c23bd7c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions src/engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@ noa_library(NAMESPACE sourcemeta 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(NAMESPACE sourcemeta PROJECT includejs NAME engine)
if(INCLUDEJS_BACKEND STREQUAL "JavaScriptCore")
install(FILES
"${PROJECT_SOURCE_DIR}/cmake/FindJavaScriptCore.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/includejs"
COMPONENT sourcemeta_includejs_dev)
endif()
endif()

sourcemeta_includejs_add_compile_options(sourcemeta_includejs_engine)

if(INCLUDEJS_BACKEND STREQUAL "JavaScriptCore")
Expand Down
1 change: 0 additions & 1 deletion test/packaging/find_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 sourcemeta::includejs::engine)

0 comments on commit c23bd7c

Please sign in to comment.