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

Building on linux gives error about not providing Findtinyxml2.cmake #124

Open
GabrielDMorales opened this issue Jan 12, 2025 · 5 comments

Comments

@GabrielDMorales
Copy link

GabrielDMorales commented Jan 12, 2025

pretty straight forward problem, the required tinyxml2 package can't be found. Creating ./cmake/modules/Findtinyxml2.cmake with the following fixes the problem:

find_path(TINYXML2_INCLUDE_DIR
          NAMES tinyxml2.h
          DOC "The Tinyxml2 include directory"
)

find_library(TINYXML2_LIBRARY
             NAMES tinyxml2
             DOC "The tinyxml2 library"
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(tinyxml2
    REQUIRED_VARS TINYXML2_LIBRARY TINYXML2_INCLUDE_DIR
)

if (TINYXML2_FOUND AND NOT TARGET tinyxml2::tinyxml2)
   add_library(tinyxml2::tinyxml2 STATIC IMPORTED)
   set_target_properties(
      tinyxml2::tinyxml2
      PROPERTIES
         INTERFACE_INCLUDE_DIRECTORIES "${TINYXML2_INCLUDE_DIR}"
         IMPORTED_LOCATION "${TINYXML2_LIBRARY}")
   if (MSVC OR MINGW)
      set_target_properties(
         tinyxml2::tinyxml2
         PROPERTIES
            IMPORTED_IMPLIB "${TINYXML2_LIBRARY}"
      )
   endif()
endif()
`
@Melechtna
Copy link

Melechtna commented Jan 27, 2025

While it doesn't build anymore for a whole different reason, just install tinyxml2

@GabrielDMorales
Copy link
Author

tinyxml2 was installed on my system, it still wouldn't find it even in my /usr/lib folder. It would not build until I provided a Findtinyxml2.cmake file, cmake could complain about it not existing even after manually installing tinyxml2. Providing the Findtinyxml2.cmake file fixed the problem. Besides, the entire point of cmake and Findtinyxml2.cmake files is to automate the downloading, installing, and finding of the shared object library in the first place.

@Melechtna
Copy link

tinyxml2 was installed on my system, it still wouldn't find it even in my /usr/lib folder. It would not build until I provided a Findtinyxml2.cmake file, cmake could complain about it not existing even after manually installing tinyxml2. Providing the Findtinyxml2.cmake file fixed the problem. Besides, the entire point of cmake and Findtinyxml2.cmake files is to automate the downloading, installing, and finding of the shared object library in the first place.

That shouldn't be nessecary, my guess is that, likely you use something that seperates out dev and regular libraries, so just installing the dev version should cover that.

@GabrielDMorales
Copy link
Author

GabrielDMorales commented Jan 27, 2025 via email

@Melechtna
Copy link

sudo apt-get install libtinyxml2-dev
no, it did not fix the problem. Again, it would not install until I
provided a .cmake file to find the library.

You MIGHT have broken pathing then, as that should get pulled in by your standard environment variables. I've never needed such a work around in multiple distros to fix finding such library pathing.

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

No branches or pull requests

2 participants