Making cmake library accessible by other cmake packages automatically -
i have 1 project produces library: project (mycoollibrary) add_library(my_cool_library shared ${mysources_src}) and project should using library: find_package (mycoollibrary required) include_directories("${mycoollibrary_include_dirs}" ) add_executable(mycoolexe ${my_sources_src} ) target_link_libraries(mycoolexe ${mycoollibrary_libraries} ) is there way can change first file second file works automatically? running cmake on first file , running make on output, running cmake on second file, cmake able find package? an answer give address of first project built second package acceptable. turning comment answer taking code found in blog post @daniperez - use cmake-enabled libraries in cmake project (iii) - i've come following minimal solution: mycoollibrary/cmakelists.txt cmake_minimum_required(version 3.3) project(mycoollibrary) function(my_export_target _target _include_dir) file( write "${cmake_current_binary_dir}/${_targ...