TriBITSPub / TriBITS

TriBITS: Tribal Build, Integrate, and Test System,
http://tribits.org
Other
36 stars 47 forks source link

Allow packages to use project() #582

Open masterleinad opened 1 year ago

masterleinad commented 1 year ago

https://github.com/trilinos/Trilinos/pull/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 https://github.com/TriBITSPub/TriBITS/blob/b669da785fb5399d6b00e8028112d6982860d07f/tribits/core/package_arch/TribitsPackageMacros.cmake#L870 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.

bartlettroscoe commented 1 year ago

I will take care of this when I extend the TriBITS example/test case TribitsExampleProject2/packages/packages1/ to use a raw CMake build system to be TriBITS-compliant for an internal build with calling no TriBITS code.

bartlettroscoe commented 10 months ago

@masterleinad, would you be willing to review the documentation and examples on how to use 100% raw CMake to create a TriBITS-compliant internal and external package:

?

Specifically, can you please review the documentation and examples at:

?

masterleinad commented 10 months ago

@masterleinad, would you be willing to review the documentation and examples on how to use 100% raw CMake to create a TriBITS-compliant internal and external package [...]

See https://github.com/TriBITSPub/TriBITS/pull/591#ref-pullrequest-1728130128 for some quick feedback.

bartlettroscoe commented 6 months ago

When using raw CMake inside of this package, this is a resolved issue as of the merge of PR:

However, if using TriBITS functions inside of the package, then some more work would need to be done (to differentiate the TriBITS project name and base source and binary directories from the most recent call to project()).

So, this should address the Kokkos use case.