trilinos/Trilinos#11779 explores using Kokkos as a native CMake project within Trilinos' TriBITS build system. In the process, I noticed that tribits_package_postprocess doesn't work properly if the package uses project(), see https://github.com/trilinos/Trilinos/pull/11779/files#r1196855222, since
|
if (${PACKAGE_NAME}_SOURCE_DIR STREQUAL ${PROJECT_NAME}_SOURCE_DIR) |
would report that the code is executed at the top level instead of at the package level and then set
${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESS in the same scope instead of in the parent scope.
Using
$(CMAKE_PROJECT_NAME}_SOURCE_DIR) instead of
$(PROJECT_NAME}_SOURCE_DIR) fixes this for me.
Note that there might be more cases where it would be more appropriate to check for
CMAKE_PROJECT_NAME instead of
PROJECT_NAME but this appears sufficient for my case.
trilinos/Trilinos#11779 explores using Kokkos as a native CMake project within
Trilinos'TriBITSbuild system. In the process, I noticed thattribits_package_postprocessdoesn't work properly if the package usesproject(), see https://github.com/trilinos/Trilinos/pull/11779/files#r1196855222, sinceTriBITS/tribits/core/package_arch/TribitsPackageMacros.cmake
Line 870 in b669da7
would report that the code is executed at the top level instead of at the package level and then set
${PACKAGE_NAME}_TRIBITS_PACKAGE_POSTPROCESSin the same scope instead of in the parent scope.Using
$(CMAKE_PROJECT_NAME}_SOURCE_DIR)instead of$(PROJECT_NAME}_SOURCE_DIR)fixes this for me.Note that there might be more cases where it would be more appropriate to check for
CMAKE_PROJECT_NAMEinstead ofPROJECT_NAMEbut this appears sufficient for my case.