Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Find tmxlite on Windows #126

Closed
LuckeeDev opened this issue Jun 3, 2023 · 4 comments
Closed

Find tmxlite on Windows #126

LuckeeDev opened this issue Jun 3, 2023 · 4 comments
Labels

Comments

@LuckeeDev
Copy link

LuckeeDev commented Jun 3, 2023

I'm trying to build a program that uses tmxlite on Windows. I built the library and everything seems to work fine, how can I allow CMake to find it? Here's my directory tree:

...
├── CMakeLists.txt
└── modules
    └── tmxlite
        ├── bin
        │   └── libtmxlite.dll
        ├── include
        │   └── tmxlite
        │       ├── Config.hpp
        │       ├── FreeFuncs.hpp
        │       ├── ImageLayer.hpp
        │       ├── Layer.hpp
        │       ├── LayerGroup.hpp
        │       ├── Map.hpp
        │       ├── Object.hpp
        │       ├── ObjectGroup.hpp
        │       ├── ObjectTypes.hpp
        │       ├── Property.hpp
        │       ├── TileLayer.hpp
        │       ├── Tileset.hpp
        │       ├── Types.hpp
        │       ├── Types.inl
        │       └── detail
        │           ├── Android.hpp
        │           └── Log.hpp
        └── lib
            ├── libtmxlite.dll.a
            └── pkgconfig
                └── tmxlite.pc
...

I'm having troubles with both header files and library files. It can't find neither of them.

@fallahn
Copy link
Owner

fallahn commented Jun 3, 2023

If you've installed the library to a sub-directory of your project, you can add it to your project's cmake file directly:

include_directories(${CMAKE_SOURCE_DIR}/modules/tmxlite/include)
link_directories(${CMAKE_SOURCE_DIR}/modelues/tmxlite/lib)

and then add it to the linker list of your executable

  add_executable(foo ${FOO_SRCS})
  target_link_libraries(foo tmxlite)

@LuckeeDev
Copy link
Author

Thank you, that worked! And what should I do if I installed tmxlite to a global folder?

@fallahn
Copy link
Owner

fallahn commented Jun 4, 2023

It's not so straight forward on windows, as there aren't default library paths like on linux/unix. This Stack Overflow answer might help: https://stackoverflow.com/questions/21314893/what-is-the-default-search-path-for-find-package-in-windows-using-cmake

@LuckeeDev
Copy link
Author

Thank you!

Repository owner locked and limited conversation to collaborators Sep 13, 2023
@fallahn fallahn converted this issue into discussion #144 Sep 13, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

2 participants