Skip to content

build: install the CMake export once, not twice - #271

Merged
mwallnoefer merged 1 commit into
emqx:masterfrom
plusky:install-cmake-export-once
Aug 27, 2026
Merged

mwallnoefer merged 1 commit into
emqx:masterfrom
plusky:install-cmake-export-once

Conversation

@plusky

@plusky plusky commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

CMakeLists.txt calls install(EXPORT ${PROJECT_NAME} ...) twice.

The second call differs from the first only by not passing FILE, so it installs the same export a second time under the default name qmqtt.cmake, next to the qmqttTargets.cmake the first call produces:

/usr/lib64/cmake/qmqtt/qmqttTargets.cmake
/usr/lib64/cmake/qmqtt/qmqttTargets-relwithdebinfo.cmake
/usr/lib64/cmake/qmqtt/qmqtt.cmake                    <- identical to the above
/usr/lib64/cmake/qmqtt/qmqtt-relwithdebinfo.cmake     <- identical to the above

Nothing includes qmqtt.cmake — the generated qmqttConfig.cmake pulls in qmqttTargets.cmake. So it is two identical exports shipped under two names, which is also what rpmlint flags downstream (files-duplicate).

This drops the second call. Consumers doing find_package(qmqtt) are unaffected, since that path goes through qmqttConfig.cmake either way.

Noticed while packaging qmqtt for openSUSE.

CMakeLists.txt calls install(EXPORT ${PROJECT_NAME} ...) twice. The second
call differs from the first only by not passing FILE, so it installs the same
export a second time under the default name qmqtt.cmake, alongside the
qmqttTargets.cmake the first call produces.

Nothing includes qmqtt.cmake: the generated qmqttConfig.cmake pulls in
qmqttTargets.cmake. The result is two identical exports shipped under two
names, which downstream packagers then have to notice and strip.

Drop the second call.
@mwallnoefer
mwallnoefer merged commit 079adef into emqx:master Aug 27, 2026
3 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.

2 participants