Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cmake option to disable install rules #585

Merged
merged 1 commit into from
Oct 14, 2023

Conversation

ilya-lavrenov
Copy link
Contributor

@ilya-lavrenov ilya-lavrenov commented Oct 11, 2023

When pugixml is used as a submodule, installation rules are not required.

Additionally, it may cause issues when pugixml is installed / exported by parent project:

CMake Error: install(EXPORT "OpenVINODeveloperTargets" ...) includes target "inference_engine_s" which requires target "pugixml-static" that is not in this export set, but in multiple other export sets: runtime/cmake/OpenVINOTargets.cmake, lib/cmake/pugixml/pugixml-targets.cmake.
An exported target cannot depend upon another target which is exported multiple times. Consider consolidating the exports of the "pugixml-static" target to a single export.
CMake Error: install(EXPORT "OpenVINODeveloperTargets" ...) includes target "func_test_utils" which requires target "pugixml-static" that is not in this export set, but in multiple other export sets: runtime/cmake/OpenVINOTargets.cmake, lib/cmake/pugixml/pugixml-targets.cmake.
An exported target cannot depend upon another target which is exported multiple times. Consider consolidating the exports of the "pugixml-static" target to a single export.
CMake Error: install(EXPORT "OpenVINODeveloperTargets" ...) includes target "funcSharedTests" which requires target "pugixml-static" that is not in this export set, but in multiple other export sets: runtime/cmake/OpenVINOTargets.cmake, lib/cmake/pugixml/pugixml-targets.cmake.
An exported target cannot depend upon another target which is exported multiple times. Consider consolidating the exports of the "pugixml-static" target to a single export.

Parent projects now can set set(PUGIXML_INSTALL OFF) to disable installation rules.

It's a good practice to provide such option. Example is https://github.com/nlohmann/json/blob/develop/CMakeLists.txt#L47

@zeux
Copy link
Owner

zeux commented Oct 13, 2023

Thanks! I'm open to merging this - it doesn't change the default behavior, and it seems fine to let people opt out of the installation rules. I'm not a CMake expert so I'm not sure why CMake can't figure things like this out on its own :)

Minor question - this PR changes the export statement to add pugixml-targets.cmake argument - is this intentional / how is this related?

NAMESPACE pugixml::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
FILE pugixml-targets.cmake)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zeux before my change export command was used with export set:

export(EXPORT pugixml-targets
  NAMESPACE pugixml::)

From cmake install command:

install(TARGETS ${install-targets}
  EXPORT pugixml-targets
  ...

But now, since install rules are under PUGIXML_INSTALL condition, we have to change the used signature of export command - call with list of targets instead of export set

@zeux zeux merged commit 2e357d1 into zeux:master Oct 14, 2023
22 checks passed
@zeux
Copy link
Owner

zeux commented Oct 14, 2023

Thanks!

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.

None yet

2 participants