Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cmake_minimum_required() calls to <Package>Config.cmake files #522

Closed
bartlettroscoe opened this issue Aug 24, 2022 · 2 comments
Closed

Comments

@bartlettroscoe
Copy link
Member

Seems the expected convention for <Package>Config.cmake files is to include a call to cmake_minimum_version() to handle any features of CMake that may need newer policies, like if (... IN_LIST ...). In particular, the example in the book "Professional CMake: 11th edition" shows:

# We use if(...IN_LIST...), make sure it is available
if(CMAKE_VERSION VERSION_LESS 3.3)
  set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
    "MyProj requires CMake 3.3 or later"
    )
  set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
  return()
endif()
cmake_minimum_required(VERSION 3.3...3.21)

This came up due to Kokkos adding extra CMake code to KokkosConfig_install.cmake as shown in:

https://github.com/trilinos/Trilinos/blob/78aac8eb821d3a9817db214c364353fdda0c0c19/packages/kokkos/cmake/kokkos_install.cmake#L32-L44

None of the TriBITS-generated <Package>Config.cmake or <Project>Config.cmake files is using if (... IN_LIST ...).

See more details in SNL internal issue TRILINOSHD-128.

@bartlettroscoe bartlettroscoe self-assigned this Aug 24, 2022
bartlettroscoe added a commit to bartlettroscoe/Trilinos that referenced this issue Aug 24, 2022
…S#522)

This is to simulate external projects that call find_package(Trilinos) that
may require an older version of CMake than that is required by
Trilinos/TriBITS.

NOTE: This exposes the error:

---------------------------------------------

CMake Warning (dev) at /ascldap/users/rabartl/Trilinos.base/BUILDS/PR/clang-10.0.0/install/lib/cmake/Kokkos/KokkosConfig.cmake:197 (IF):
  Policy CMP0057 is not set: Support new IN_LIST if() operator.  Run "cmake
  --help-policy CMP0057" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  IN_LIST will be interpreted as an operator when the policy is set to NEW.
  Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
  /ascldap/users/rabartl/Trilinos.base/BUILDS/PR/clang-10.0.0/install/lib/cmake/Trilinos/TrilinosConfig.cmake:114 (include)
  CMakeLists.txt:8 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at /ascldap/users/rabartl/Trilinos.base/BUILDS/PR/clang-10.0.0/install/lib/cmake/Kokkos/KokkosConfig.cmake:197 (IF):
  if given arguments:

    "Kokkos_ENABLE_THREADS" "AND" "NOT" "DEPRECATED_CODE_3" "IN_LIST" "Kokkos_OPTIONS"

  Unknown arguments specified
Call Stack (most recent call first):
  /ascldap/users/rabartl/Trilinos.base/BUILDS/PR/clang-10.0.0/install/lib/cmake/Trilinos/TrilinosConfig.cmake:114 (include)
  CMakeLists.txt:8 (find_package)

-- Configuring incomplete, errors occurred!

---------------------------------------------

reported in trilinos#10456 and TRILINOSHD-128

In a later commit, we will update the version of TriBITS that addresses this.
bartlettroscoe added a commit to bartlettroscoe/TriBITS that referenced this issue Aug 24, 2022
This addresses an issue where Kokkos updates the KokkosConfig_install.cmake
file to use 'if (... IN_LIST ...)'.

NOTE: There is no test in TriBITS that checks for this change because the
TriBITS-generated <Package>Config.cmake and <Project>Config.cmake files don't
use 'if (... IN_LIST ...)'.  I had to manually test this against Trilinos to
verify this makes the error go away.  All that the TriBITS testing does is
ensure that this change does not break these files for the TriBITS use cases.
bartlettroscoe added a commit that referenced this issue Aug 25, 2022
Add version check and calls to cmake_minimum_required() (#522)
@bartlettroscoe
Copy link
Member Author

For a longer discussion of why we need to do this, see trilinos/Trilinos#10930 (comment).

bartlettroscoe added a commit to bartlettroscoe/TriBITS that referenced this issue Aug 25, 2022
…REQUIRED (TriBITSPub#522)

This was changed from the open-ended ${CMAKE_VERSION}.  This way, we allow
CMake to use a more current set of policies while not writting future futures
of CMake a blank check.

This change was made based on feedback from @KyleFromKitware from the
post-merge review of TriBITSPub#523.

NOTE: I manaully tested this with a configure of Trilinos and it produded:

  cmake_minimum_required(VERSION 3.3...3.17.0)
bartlettroscoe added a commit that referenced this issue Aug 25, 2022
Change cmake_minimum_required() to upper bound TRIBITS_CMAKE_MINIMUM_REQUIRED (#522)
@bartlettroscoe
Copy link
Member Author

With the merge of PRs #523 and #524 and the updated snapshot of TriBITS 'master' into Trilinos 'develop' with the merge of PR trilinos/Trilinos#10930, this issue is resolved.

jmgate pushed a commit to tcad-charon/Trilinos that referenced this issue Aug 26, 2022
…s:develop' (8906842).

* trilinos-develop: (128 commits)
  Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929)
  Tpetra: Adding configure option to disable Kokkos integration test
  Automatic snapshot commit from tribits at 142e5362
  Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931)
  Force disable Pliris in ATS2 builds (trilinos#10931)
  Automatic snapshot commit from tribits at ab419429
  Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522)
  Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516)
  Remove printing of vars that are now empty (TriBITSPub/TriBITS#299)
  Panzer: move periodic helper typedefs into namespace
  Revert incorrect fix in previous commit
  Fix typos in some docs
  fix scratch typos
  STK: Snapshot 08-22-22 12:44
  Phalanx: remove cuda compiler warnings and add test for new use case for vov
  changed a double to a scalar_type to compile for complex arith
  MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp
  Amesos2 : trying to fix MKL header including issues
  MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate
  Testing on Geminga: Do not disable Kokkos in Epetra build
  ...
jmgate pushed a commit to tcad-charon/Trilinos that referenced this issue Aug 27, 2022
…s:develop' (8906842).

* trilinos-develop: (130 commits)
  Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929)
  Tpetra: Adding configure option to disable Kokkos integration test
  MueLu: Allow to print Kokkos config when default node type is used
  Automatic snapshot commit from tribits at 142e5362
  Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931)
  Force disable Pliris in ATS2 builds (trilinos#10931)
  Automatic snapshot commit from tribits at ab419429
  Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522)
  Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516)
  Remove printing of vars that are now empty (TriBITSPub/TriBITS#299)
  Panzer: move periodic helper typedefs into namespace
  Revert incorrect fix in previous commit
  Fix typos in some docs
  fix scratch typos
  STK: Snapshot 08-22-22 12:44
  Phalanx: remove cuda compiler warnings and add test for new use case for vov
  changed a double to a scalar_type to compile for complex arith
  MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp
  Amesos2 : trying to fix MKL header including issues
  MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate
  ...
jmgate pushed a commit to tcad-charon/Trilinos that referenced this issue Aug 28, 2022
…s:develop' (8906842).

* trilinos-develop: (130 commits)
  Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929)
  Tpetra: Adding configure option to disable Kokkos integration test
  MueLu: Allow to print Kokkos config when default node type is used
  Automatic snapshot commit from tribits at 142e5362
  Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931)
  Force disable Pliris in ATS2 builds (trilinos#10931)
  Automatic snapshot commit from tribits at ab419429
  Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522)
  Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516)
  Remove printing of vars that are now empty (TriBITSPub/TriBITS#299)
  Panzer: move periodic helper typedefs into namespace
  Revert incorrect fix in previous commit
  Fix typos in some docs
  fix scratch typos
  STK: Snapshot 08-22-22 12:44
  Phalanx: remove cuda compiler warnings and add test for new use case for vov
  changed a double to a scalar_type to compile for complex arith
  MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp
  Amesos2 : trying to fix MKL header including issues
  MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate
  ...
jmgate pushed a commit to tcad-charon/Trilinos that referenced this issue Aug 29, 2022
…s:develop' (8906842).

* trilinos-develop: (130 commits)
  Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929)
  Tpetra: Adding configure option to disable Kokkos integration test
  MueLu: Allow to print Kokkos config when default node type is used
  Automatic snapshot commit from tribits at 142e5362
  Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931)
  Force disable Pliris in ATS2 builds (trilinos#10931)
  Automatic snapshot commit from tribits at ab419429
  Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522)
  Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516)
  Remove printing of vars that are now empty (TriBITSPub/TriBITS#299)
  Panzer: move periodic helper typedefs into namespace
  Revert incorrect fix in previous commit
  Fix typos in some docs
  fix scratch typos
  STK: Snapshot 08-22-22 12:44
  Phalanx: remove cuda compiler warnings and add test for new use case for vov
  changed a double to a scalar_type to compile for complex arith
  MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp
  Amesos2 : trying to fix MKL header including issues
  MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate
  ...
jmgate pushed a commit to tcad-charon/Trilinos that referenced this issue Aug 29, 2022
…s:develop' (8906842).

* trilinos-develop: (130 commits)
  Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929)
  Tpetra: Adding configure option to disable Kokkos integration test
  MueLu: Allow to print Kokkos config when default node type is used
  Automatic snapshot commit from tribits at 142e5362
  Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931)
  Force disable Pliris in ATS2 builds (trilinos#10931)
  Automatic snapshot commit from tribits at ab419429
  Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522)
  Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516)
  Remove printing of vars that are now empty (TriBITSPub/TriBITS#299)
  Panzer: move periodic helper typedefs into namespace
  Revert incorrect fix in previous commit
  Fix typos in some docs
  fix scratch typos
  STK: Snapshot 08-22-22 12:44
  Phalanx: remove cuda compiler warnings and add test for new use case for vov
  changed a double to a scalar_type to compile for complex arith
  MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp
  Amesos2 : trying to fix MKL header including issues
  MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate
  ...
jmgate pushed a commit to tcad-charon/Trilinos that referenced this issue Aug 29, 2022
…s:develop' (8906842).

* trilinos-develop: (130 commits)
  Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929)
  Tpetra: Adding configure option to disable Kokkos integration test
  MueLu: Allow to print Kokkos config when default node type is used
  Automatic snapshot commit from tribits at 142e5362
  Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931)
  Force disable Pliris in ATS2 builds (trilinos#10931)
  Automatic snapshot commit from tribits at ab419429
  Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522)
  Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516)
  Remove printing of vars that are now empty (TriBITSPub/TriBITS#299)
  Panzer: move periodic helper typedefs into namespace
  Revert incorrect fix in previous commit
  Fix typos in some docs
  fix scratch typos
  STK: Snapshot 08-22-22 12:44
  Phalanx: remove cuda compiler warnings and add test for new use case for vov
  changed a double to a scalar_type to compile for complex arith
  MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp
  Amesos2 : trying to fix MKL header including issues
  MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate
  ...
jmgate pushed a commit to tcad-charon/Trilinos that referenced this issue Aug 29, 2022
…s:develop' (8906842).

* trilinos-develop: (130 commits)
  Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929)
  Tpetra: Adding configure option to disable Kokkos integration test
  MueLu: Allow to print Kokkos config when default node type is used
  Automatic snapshot commit from tribits at 142e5362
  Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931)
  Force disable Pliris in ATS2 builds (trilinos#10931)
  Automatic snapshot commit from tribits at ab419429
  Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522)
  Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516)
  Remove printing of vars that are now empty (TriBITSPub/TriBITS#299)
  Panzer: move periodic helper typedefs into namespace
  Revert incorrect fix in previous commit
  Fix typos in some docs
  fix scratch typos
  STK: Snapshot 08-22-22 12:44
  Phalanx: remove cuda compiler warnings and add test for new use case for vov
  changed a double to a scalar_type to compile for complex arith
  MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp
  Amesos2 : trying to fix MKL header including issues
  MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate
  ...
jmgate pushed a commit to tcad-charon/Trilinos that referenced this issue Aug 29, 2022
…s:develop' (8906842).

* trilinos-develop: (130 commits)
  Intrepid2: update TensorData.setFirstComponentExtentInDimension0 to modify extents_[0] (trilinos#10929)
  Tpetra: Adding configure option to disable Kokkos integration test
  MueLu: Allow to print Kokkos config when default node type is used
  Automatic snapshot commit from tribits at 142e5362
  Disable Pliris tests in ATS2 GenConfig builds (trilinos#10931)
  Force disable Pliris in ATS2 builds (trilinos#10931)
  Automatic snapshot commit from tribits at ab419429
  Change cmake_minimum_required() from 3.17.1 to 3.0 (TriBITSPub/TriBITS#522)
  Pliris: Remove local var hiding cache var Pliris_ENABLE_DREAL (trilinos#10774, TriBITSPub/TriBITS#516)
  Remove printing of vars that are now empty (TriBITSPub/TriBITS#299)
  Panzer: move periodic helper typedefs into namespace
  Revert incorrect fix in previous commit
  Fix typos in some docs
  fix scratch typos
  STK: Snapshot 08-22-22 12:44
  Phalanx: remove cuda compiler warnings and add test for new use case for vov
  changed a double to a scalar_type to compile for complex arith
  MueLu: Fix signed vs unsigned comparison in Aggregates_kokkos.cpp
  Amesos2 : trying to fix MKL header including issues
  MueLu: Add Aggregates_kokkos.ComputeNodesInAggregate
  ...
cgcgcg pushed a commit to cgcgcg/Trilinos that referenced this issue Sep 12, 2022
…S#522)

This is to simulate external projects that call find_package(Trilinos) that
may require an older version of CMake than that is required by
Trilinos/TriBITS.

NOTE: This exposes the error:

---------------------------------------------

CMake Warning (dev) at /ascldap/users/rabartl/Trilinos.base/BUILDS/PR/clang-10.0.0/install/lib/cmake/Kokkos/KokkosConfig.cmake:197 (IF):
  Policy CMP0057 is not set: Support new IN_LIST if() operator.  Run "cmake
  --help-policy CMP0057" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  IN_LIST will be interpreted as an operator when the policy is set to NEW.
  Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
  /ascldap/users/rabartl/Trilinos.base/BUILDS/PR/clang-10.0.0/install/lib/cmake/Trilinos/TrilinosConfig.cmake:114 (include)
  CMakeLists.txt:8 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at /ascldap/users/rabartl/Trilinos.base/BUILDS/PR/clang-10.0.0/install/lib/cmake/Kokkos/KokkosConfig.cmake:197 (IF):
  if given arguments:

    "Kokkos_ENABLE_THREADS" "AND" "NOT" "DEPRECATED_CODE_3" "IN_LIST" "Kokkos_OPTIONS"

  Unknown arguments specified
Call Stack (most recent call first):
  /ascldap/users/rabartl/Trilinos.base/BUILDS/PR/clang-10.0.0/install/lib/cmake/Trilinos/TrilinosConfig.cmake:114 (include)
  CMakeLists.txt:8 (find_package)

-- Configuring incomplete, errors occurred!

---------------------------------------------

reported in trilinos#10456 and TRILINOSHD-128

In a later commit, we will update the version of TriBITS that addresses this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

1 participant