Skip to content

Fix CMake config installation path to match package name#1479

Merged
saghul merged 2 commits into
quickjs-ng:masterfrom
qr243vbi:patch-1
May 19, 2026
Merged

Fix CMake config installation path to match package name#1479
saghul merged 2 commits into
quickjs-ng:masterfrom
qr243vbi:patch-1

Conversation

@qr243vbi
Copy link
Copy Markdown
Contributor

@qr243vbi qr243vbi commented May 17, 2026

The qjsConfig.cmake should be named as quickjsConfig.cmake instead, in order to match the package name and help CMake (the find_package(quickjs) command) find the requested library configuration.

@saghul
Copy link
Copy Markdown
Contributor

saghul commented May 17, 2026

What is this fixing?

@qr243vbi
Copy link
Copy Markdown
Contributor Author

What is this fixing?

qjs not found error

@bnoordhuis
Copy link
Copy Markdown
Contributor

Isn't that just you using the wrong path? Can you show what you tried to do in your own cmake files that errored?

@qr243vbi
Copy link
Copy Markdown
Contributor Author

find_package(qjs CONFIG QUIET)

@saghul
Copy link
Copy Markdown
Contributor

saghul commented May 18, 2026

I guess this is because the target name is qjs and thus cmake generates that directory?

What would it take to change it to "quickjs" so projects do find_package(quickjs CONFIG QUIET)

instead?

@CarterLi
Copy link
Copy Markdown

@saghul sorry for a duplicate PR.

What would it take to change it to "quickjs" so projects do find_package(quickjs CONFIG QUIET)

find_package(%pkgname%) will search ${prefix}/lib/cmake/%pkgname%/%pkgname%Config.cmake

So if you do find_package(quickjs CONFIG QUIET), CMake will search ${prefix}/lib/cmake/quickjs/quickjsConfig.cmake, which doesn't exist either.

install(EXPORT qjsConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/quickjs)

This line will generate ${CMAKE_INSTALL_LIBDIR}/cmake/quickjs/qjsConfig.cmake, we must either change EXPORT qjsConfig to EXPORT quickjsConfig (find_package(quickjs) will work in this case), or change DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/quickjs to DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/qjs

@qr243vbi qr243vbi changed the title Fix quickjs cmake config Fix CMake config installation path to match package name May 19, 2026
@qr243vbi
Copy link
Copy Markdown
Contributor Author

qr243vbi commented May 19, 2026

I guess this is because the target name is qjs and thus cmake generates that directory?

What would it take to change it to "quickjs" so projects do find_package(quickjs CONFIG QUIET)

instead?

No, that does not work. I tried both find_package(quickjs CONFIG QUIET) and find_package(qjs CONFIG QUIET), but neither works due to a bug in CMakeLists.txt of quickjs-ng. I renamed qjsConfig to quickjsConfig, which made find_package(quickjs CONFIG QUIET) work correctly.

@saghul
Copy link
Copy Markdown
Contributor

saghul commented May 19, 2026

I think keeping things as is (plus this PR) is the right thing to do now, otherwise everyone might need to adapt their CMake files.

We can reconsider that for 1.0 maybe.

EDIT: Nevermind, I mixed the 2 PRs. I'm landing this.

@saghul saghul merged commit 32eb2ce into quickjs-ng:master May 19, 2026
124 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants