[
https://issues.apache.org/jira/browse/XERCESC-2236?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Scott Cantor resolved XERCESC-2236.
-----------------------------------
Resolution: Fixed
Thanks, applied to branch as well.
> Dependencies aren't loaded when using provided CMake config package
> -------------------------------------------------------------------
>
> Key: XERCESC-2236
> URL: https://issues.apache.org/jira/browse/XERCESC-2236
> Project: Xerces-C++
> Issue Type: Bug
> Components: Build
> Affects Versions: 3.2.3
> Environment: Ubuntu 18.04, CMake 3.22.2
> Reporter: Fred Hornsey
> Assignee: Scott Cantor
> Priority: Major
> Fix For: 3.2.4
>
> Attachments: xercesc-2236-fix.patch
>
>
> We have a CMake config package for our libraries that tries to load Xerces
> support like so:
> {code:java}
> find_package(XercesC PATHS "${OPENDDS_XERCES3}" NO_DEFAULT_PATH)
> if (NOT XercesC_FOUND)
> find_package(XercesC)
> endif(){code}
> Where {{OPENDDS_XERCES3}} is the path to the Xerces our libraries were built
> with. This works on Windows and Linux when using system-provided package.
> When building and installing from source on Linux it seem this doesn't work.
> In this case it's trying to use the CMake package provided by Xerces instead
> of the one builtin to CMake.
> I've created an example to demonstrate this. Xerces is built and installed to
> a location on Linux using CMake. Then we create a {{{}CMakeLists.txt{}}}:
> {code:java}
> cmake_minimum_required(VERSION 3.12.0)
> project(xerces_cmake_config_pkg_test)
> find_package(XercesC PATHS "${THE_XERCES_ROOT}" NO_DEFAULT_PATH)
> add_executable(testexe test.cpp)
> target_link_libraries(testexe XercesC::XercesC)
> {code}
> {{test.cpp}} has to be created, but it doesn't matter what it contains
> because CMake doesn't get far enough to allow us to attempt to build. When
> configuring, setting {{THE_XERCES_ROOT}} to the installed Xerces, CMake gives
> these errors:
> {code:java}
> CMake Error at CMakeLists.txt:10 (add_executable):
> Target "testexe" links to target "ICU::uc" but the target was not found.
> Perhaps a find_package() call is missing for an IMPORTED target, or an
> ALIAS target is missing?
> CMake Error at CMakeLists.txt:10 (add_executable):
> Target "testexe" links to target "ICU::data" but the target was not found.
> Perhaps a find_package() call is missing for an IMPORTED target, or an
> ALIAS target is missing?
> CMake Error at CMakeLists.txt:10 (add_executable):
> Target "testexe" links to target "Threads::Threads" but the target was not
> found. Perhaps a find_package() call is missing for an IMPORTED target, or
> an ALIAS target is missing? {code}
>
> This seems to be caused by the packages being specified by Xerces during its
> configure ([like
> ICU|https://github.com/apache/xerces-c/blob/045bdf8ac7755e1ce2735d5ef3f6741ec4718df9/src/CMakeLists.txt#L1113])
> being referenced in the Config package, but not being loaded for the using
> {{find_package}} or equivalent. [CMake
> documenation|https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#creating-a-package-configuration-file]
> suggests that this should be done in somewhere in the [config
> file|https://github.com/apache/xerces-c/blob/master/src/xercesc/util/XercesVersion.hpp.in].
>
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]