diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in index 9122881b8..1d0b012a1 100644 --- a/cmake/CeresConfig.cmake.in +++ b/cmake/CeresConfig.cmake.in @@ -120,11 +120,11 @@ get_filename_component(CERES_CURRENT_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) if (CERES_WAS_INSTALLED) - # Reset CMake module path to the installation directory of this - # script, thus we will use the FindPackage() scripts shipped with - # Ceres to find Ceres' dependencies, even if the user has equivalently - # named FindPackage() scripts in their project. - set(CMAKE_MODULE_PATH ${CERES_CURRENT_CONFIG_DIR}) + # Update the CMake module path to include the installation directory of this + # script, thus we will use the FindPackage() scripts shipped with Ceres to + # find Ceres' dependencies, even if the user has equivalently named + # FindPackage() scripts in their project. + list(PREPEND CMAKE_MODULE_PATH ${CERES_CURRENT_CONFIG_DIR}) # Build the absolute root install directory as a relative path # (determined when Ceres was configured & built) from the current @@ -155,11 +155,11 @@ else(CERES_WAS_INSTALLED) "directory: ${CERES_EXPORTED_BUILD_DIR} does not exist.") endif() - # Reset CMake module path to the cmake directory in the Ceres source - # tree which was exported, thus we will use the FindPackage() scripts shipped - # with Ceres to find Ceres' dependencies, even if the user has equivalently - # named FindPackage() scripts in their project. - set(CMAKE_MODULE_PATH ${CERES_EXPORTED_SOURCE_DIR}/cmake) + # Update the CMake module path to include the cmake directory in the Ceres + # source tree which was exported, thus we will use the FindPackage() scripts + # shipped with Ceres to find Ceres' dependencies, even if the user has + # equivalently named FindPackage() scripts in their project. + list(PREPEND CMAKE_MODULE_PATH ${CERES_EXPORTED_SOURCE_DIR}/cmake) endif(CERES_WAS_INSTALLED) # Set the version.