Set tinyxml2_LIBRARIES after find_package()#3918
Conversation
92c1772 to
10f1595
Compare
-- ------------------ General configuration for Cppcheck 2.7.3 -----------------
...
-- USE_BUNDLED_TINYXML2 = OFF
-- tinyxml2_LIBRARIES = tinyxml2 |
|
This is a followup to #3897 |
|
@c72578 I had the same problem, because tinyxml2 installs an incomplete CMake module/package, which does not set any of the expected diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake
index d1cf61848..a91b89053 100644
--- a/cmake/findDependencies.cmake
+++ b/cmake/findDependencies.cmake
@@ -47,7 +47,7 @@ endif()
if (NOT USE_BUNDLED_TINYXML2)
find_package(tinyxml2 QUIET)
- if (NOT tinyxml2_FOUND)
+ if (NOT tinyxml2_FOUND OR NOT tinyxml2_LIBRARIES)
find_library(tinyxml2_LIBRARIES tinyxml2)
if (NOT tinyxml2_LIBRARIES)
message(FATAL_ERROR "tinyxml2 has not been found")I did not tough of this before, but it seems more rational now. |
|
@gdsotirov Thanks for the feedback and the link to the upstream tinyxml2 issue leethomason/tinyxml2#904. These variables are currently available after
-- tinyxml2_CONFIG=/usr/lib64/cmake/tinyxml2/tinyxml2Config.cmake
-- tinyxml2_CONSIDERED_CONFIGS=/usr/lib64/cmake/tinyxml2/tinyxml2Config.cmake
-- tinyxml2_CONSIDERED_VERSIONS=unknown
-- tinyxml2_DIR=/usr/lib64/cmake/tinyxml2
-- tinyxml2_FOUND=1
-- tinyxml2_VERSION_COUNT=0
-- tinyxml2_VERSION_MAJOR=0
-- tinyxml2_VERSION_MINOR=0
-- tinyxml2_VERSION_PATCH=0
-- tinyxml2_VERSION_TWEAK=0
-- tinyxml2_CONFIG=/usr/lib64/cmake/tinyxml2/tinyxml2-config.cmake
-- tinyxml2_CONSIDERED_CONFIGS=/usr/lib64/cmake/tinyxml2/tinyxml2-config.cmake
-- tinyxml2_CONSIDERED_VERSIONS=9.0.0
-- tinyxml2_DIR=/usr/lib64/cmake/tinyxml2
-- tinyxml2_FOUND=1
-- tinyxml2_VERSION=9.0.0
-- tinyxml2_VERSION_COUNT=3
-- tinyxml2_VERSION_MAJOR=9
-- tinyxml2_VERSION_MINOR=0
-- tinyxml2_VERSION_PATCH=0
-- tinyxml2_VERSION_TWEAK=0
-- tinyxml2_comp_shared=NO
-- tinyxml2_comp_static=NO
-- tinyxml2_known_comps=static;shared
-- tinyxml2_shared_targets=/usr/lib64/cmake/tinyxml2/tinyxml2-shared-targets.cmake
-- tinyxml2_static_targets=/usr/lib64/cmake/tinyxml2/tinyxml2-static-targets.cmakeSo yes, currently there is no |
|
Indeed, no |
If tinyxml2 is found by find_package(), then tinyxml2_LIBRARIES is empty. Set tinyxml2_LIBRARIES to "tinyxml2::tinyxml2" in this case. - Fixes "undefined reference to `tinyxml2::" - printInfo.cmake: Fix indentation of tinyxml2_LIBRARIES
10f1595 to
72ff5fd
Compare
@alexreinking Thanks for taking the time to have a look at this PR and the feedback. |
-- ------------------ General configuration for Cppcheck 2.7.3 -----------------
...
-- USE_BUNDLED_TINYXML2 = OFF
-- tinyxml2_LIBRARIES = tinyxml2::tinyxml2
|
|
I have no idea about this.. when everbody is happy I feel I can merge this.. |
|
It works for me. |
It should not be necessary after PR 3918 is merged. See cppcheck-opensource/cppcheck#3918
|
Well.. if you feel that a new 2.7.x tag is wanted that has these changes then ping me. |
Yeah, we need that so it works without additional patches. |
|
I will prepare a PR for the 2.7.x branch ... |
|
A PR for the 2.7.x branch has been prepared: #3932 |
If tinyxml2 is found by
find_package(), thentinyxml2_LIBRARIESis empty. Set
tinyxml2_LIBRARIESto"tinyxml2::tinyxml2"in this case.undefined reference totinyxml2::`"printInfo.cmake: Fix indentation oftinyxml2_LIBRARIES