Page MenuHomePhabricator

MODULES_PACKAGE_DEPENDS_DIR order is wrong in generated projects
Closed, ResolvedPublic

Description

Hi,

I noticed that some of our MITK_<package>_Config.cmake files are not processed even if a the package is added to the dependencies of a module.

Although there can be several PackageDepends directories, the MITK_USE_MODULE macro looks only for the first one in which it finds a config file for the given module.

This is all right, but in our external project our PackageDepends directory was *appended* to the PackageDepends directory list, and so, if there was a config file for a package both in MITK and NifTK then only that of MITK was processed.

I open a ticket for this because the same is done in the template file of the plugin generator:

set(${PROJECT_NAME}_MODULES_PACKAGE_DEPENDS_DIR "${PROJECT_SOURCE_DIR}/CMake/PackageDepends")
list(APPEND MODULES_PACKAGE_DEPENDS_DIRS ${${PROJECT_NAME}_MODULES_PACKAGE_DEPENDS_DIR})

The second line should probably be

list(INSERT MODULES_PACKAGE_DEPENDS_DIRS 0 ${${PROJECT_NAME}_MODULES_PACKAGE_DEPENDS_DIR})

so that the external projects can override the original config.

Cheers,
Miklos