<div dir="ltr">Hi,<div><br></div><div>I'm trying to get my head around CMake config files to use in combination with find_package.</div><div>So currently I have a given library target setup.</div><div><br></div><div>Then I call a configure_package_config_file to generate some TargetConfig.cmake.</div><div>After that I call an export on the target.</div><div><br></div><div>The files are generated fine, and it looks fine, except for one thing, which is that the libraries it imports use absolute paths.</div><div>The export command generates the cmake file which imports targets, but it does it like this, using absolute paths:</div><div><br></div><div><div>set_target_properties(MCore PROPERTIES</div><div>  IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"</div><div>  IMPORTED_LOCATION_PROFILE <b>"C:/Test/Lib/MCore_Debug.lib"</b></div><div>  )</div></div><div><br></div><div>As I cannot ship the config files using absolute paths I need to make them use relative paths. However I cannot get the export command to output a relative path.<br></div><div><br></div><div>Does anyone know how I should do this? Or using some prefix variable and then relative to that.</div><div><br></div><div>I currently export like this:</div><div>--------------</div><div><div>configure_package_config_file(<span class="" style="white-space:pre">   </span>"<a href="http://MCoreConfig.cmake.in">MCoreConfig.cmake.in</a>" <span class="" style="white-space:pre">         </span>"${CMAKE_BINARY_DIR}/MCoreConfig.cmake" </div><div><span class="" style="white-space:pre">                                                </span>INSTALL_DESTINATION <span class="" style="white-space:pre">              </span>${CMAKECONFIG_INSTALL_DIR} </div><div><span class="" style="white-space:pre">                                               </span>PATH_VARS <span class="" style="white-space:pre">                                </span>INCLUDE_DIR CONF_RELATIVE_DIR CUSTOM_ROOT)</div><div><br></div><div>export( TARGETS MCore FILE "${CMAKE_BINARY_DIR}/MCoreTargets.cmake" )</div><div>install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MCoreConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/MCoreTargets.cmake" DESTINATION "${CUSTOM_ROOT}/CMake" )<br></div><div>-----------</div></div><div>I basically need everything relative to the ${CUSTOM_ROOT} folder.</div><div><br></div><div>Any hints/help would be appreciated :)</div><div><br></div><div>Thanks,</div><div>- John</div></div>