kcat / alure

Alure is a utility library for OpenAL, providing a C++ API and managing common tasks that include file loading, caching, and streaming
zlib License
70 stars 20 forks source link

Let CMakeLists.txt export ALURE_LIBRARIES and ALURE_INCLUDE_DIRS #4

Closed karamellpelle closed 6 years ago

karamellpelle commented 7 years ago

Hello! Is it possible to let ./CMakeLists.txt export ALURE_LIBRARIES and ALURE_INCLUDE_DIRS? I have alure as a git submodule and use it as a cmake submodule (add_subdirectory( alure )). In my top CMakeLists.txt it would be nice to use these variables and not hardcode the paths and link libraries by hand.

For example, the submodule glfw of mine makes this possible:

set(GLFW_LIBRARIES ${glfw_LIBRARIES} CACHE STRING "Dependencies of GLFW")
karamellpelle commented 7 years ago

I suppose this at the end will do the job:

set(ALURE_LIBRARIES alure2 ${alure_libs} CACHE STRING "Dependencies of ALURE")

But better: Add all include and link dependencies of target alure2 with target_include_directories() and target_link_libraries(). And for each optional package dependency found (like mpg123), add it to alure2. Now I have to find these optional packages (i.e. mpg123) by myself again, and then add them to my target.

kcat commented 6 years ago

But better: Add all include and link dependencies of target alure2 with target_include_directories() and target_link_libraries(). And for each optional package dependency found (like mpg123), add it to alure2.

This should be the case now. It should also work for alure2_s (for static linking). Is there anything else it should do to "expose" the alure2 and alure2_s targets for whatever includes this CMakeLists.txt?

karamellpelle commented 6 years ago

I'm not sure what else the CMakeLists.txt should do; I'm not very into CMake right now.

However, using Alure with the newest commit as a submodule works well. Thank you!