Set tinyxml2_LIBRARIES after find_package() (#3932)

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-25 06:58:59 +01:00 committed by GitHub
parent 9ef14d179d
commit 1cc234ac2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -48,12 +48,13 @@ 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")
else()
message(STATUS "tinyxml2_LIBRARY: ${tinyxml2_LIBRARY}")
set(tinyxml2_FOUND 1)
endif()
endif()

View File

@ -52,9 +52,10 @@ if (USE_Z3)
message( STATUS "Z3_LIBRARIES = ${Z3_LIBRARIES}" )
message( STATUS "Z3_CXX_INCLUDE_DIRS = ${Z3_CXX_INCLUDE_DIRS}" )
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 )