by Oleksandr Senkovych
find_package(Example 1.0.0 REQUIRED)add_executable(hello_world main.cpp)
target_link_libraries(
hello_world Example::example
)
Manually specify prefix path every time
export(PACKAGE Example)* Package name is case sensitive
target_include_directories(example
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
)
cmake -DCMAKE_MODULE_PATH=libexample/build
cmake -DExample_DIR=libexample/build
It's Time To Do CMake Right
https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/
cmake-packages documentation
https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html
Daniel Pfeifer - "Effective CMake"
https://www.youtube.com/watch?v=rLopVhns4Zs&feature=youtu.be