cpm-cmake / CPM.cmake

📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding libraries taht don't export `_INCLUDE_DIR`

ethindp opened this issue · comments

@CraigHutchinson I have a library that I've added in that doesn't export a location for it's include directories. Is there a way I can "discover" these, i.e. figure out where the project was downloaded to and then set that with target_include_directories?

It has been a while, but in case you still have not solved the problem, it may be worth it to try:

target_include_directories(target PUBLIC ${library_name_SOURCE_DIR}/path/to/include/directory)

For example, when I use GLEW, I have to use:

target_include_directories(ProjectExecutable PUBLIC ${glew_SOURCE_DIR}/include)

Capitalization of the library_name should match the capitalization of the NAME argument to CPMAddPackage. If you still have trouble finding the value of library_name use CPM_LAST_PACKAGE_NAME. This is populated with the NAME value of the most recently added package.

For more detailed information you can check the Usage section of the README.md file in this repository.

  • <dependency>_SOURCE_DIR is the path to the source of the dependency