Set tinyxml2_LIBRARIES after find_package() (#3918)

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
This commit is contained in:
Wolfgang Stöggl 2022-03-22 21:41:44 +01:00 committed by GitHub
parent 40c2687ac4
commit 3cefba0259
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -47,7 +47,9 @@ endif()
if (NOT USE_BUNDLED_TINYXML2)
find_package(tinyxml2 QUIET)
if (NOT tinyxml2_FOUND)
if (TARGET tinyxml2::tinyxml2)
set(tinyxml2_LIBRARIES "tinyxml2::tinyxml2")
else()
find_library(tinyxml2_LIBRARIES tinyxml2)
if (NOT tinyxml2_LIBRARIES)
message(FATAL_ERROR "tinyxml2 has not been found")

View File

@ -66,7 +66,7 @@ endif()
message( STATUS )
message( STATUS "USE_BUNDLED_TINYXML2 = ${USE_BUNDLED_TINYXML2}" )
if (NOT USE_BUNDLED_TINYXML2)
message(STATUS "tinyxml2_LIBRARIES = ${tinyxml2_LIBRARIES}")
message(STATUS "tinyxml2_LIBRARIES = ${tinyxml2_LIBRARIES}")
endif()
message( STATUS )
message( STATUS "USE_BOOST = ${USE_BOOST}" )