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

Minimum cmake version for blt #109

Closed
kennyweiss opened this issue Oct 30, 2017 · 11 comments
Closed

Minimum cmake version for blt #109

kennyweiss opened this issue Oct 30, 2017 · 11 comments

Comments

@kennyweiss
Copy link
Member

kennyweiss commented Oct 30, 2017

We should define the minimum cmake version allowed for blt-based projects.

This minimum version should be tested/checked within blt, and should be clearly indicated in our documentation.

One of our core macros used for transitive dependencies is using a cmake 3.3 feature:

if(... IN_LIST ...)

This feature also requires setting cmake policy CMP0057 to NEW (as pointed out by @zbeekman in PR #108).

Note: Setting a value for CMP0057 is only valid in Cmake versions above 3.3 and is required in versions above 3.3.2 when using if(.. IN_LIST ...).

See: https://cmake.org/cmake/help/v3.3/policy/CMP0057.html

@kennyweiss kennyweiss changed the title Minumum cmake version for blt Minimum cmake version for blt Oct 30, 2017
@zbeekman
Copy link
Contributor

Where would be the most appropriate place to set CMP0057 to NEW. I'd like to include that in my PR (#108).

@kennyweiss
Copy link
Member Author

Thanks -- I'd think it should be around here -- https://github.com/LLNL/blt/blob/master/SetupBLT.cmake#L63 -- in SetupBLT.cmake.

It should be guarded by the version until we decide about adding a cmake_minimum_version to blt (and which version that should be), since earlier cmake versions will complain about unknown policies.
E.g.

if("${CMAKE_VERSION}" VERSION_GREATER 3.3)
    cmake_policy(SET CMP0057 NEW)
endif()

@zbeekman
Copy link
Contributor

zbeekman commented Oct 30, 2017 via email

@kennyweiss
Copy link
Member Author

kennyweiss commented Oct 30, 2017

I think that it is a feature that is not yet in our blt tests.
It comes up when there is a transitive dependency in the DEPENDS_ON lists.

Perhaps we should avoid resolving the policy part of this problem within BLT until the cmake_minimum_version is decided. In the meantime, it is easy to add both a minimum version and the cmake policy part to your project's build system.

@zbeekman
Copy link
Contributor

Perhaps we should avoid resolving the policy part of this problem within BLT until the cmake_minimum_version is decided. In the meantime, it is easy to add both a minimum version and the cmake policy part to your project's build system.

OK, I'll hold off adding the policy in my PR and leave it as the more portable/flexible MATCHES variant.

@kennyweiss
Copy link
Member Author

Thanks @zbeekman.

It looks like we will explicit require cmake-3.3+ for basic blt functionality by testing against ${CMAKE_VERSION} in blt and throwing a FATAL_ERROR for earlier versions.

We will most likely not be adding the cmake_minimum_version to blt since this macro has side effects, and is better left to the user projects that brings in blt.

It is also worth mentioning that some of the CUDA functionality requires a significantly newer version of cmake (e.g. cmake-3.8.x), but since this is an optional feature of blt, we will not make this a requirement for all blt users.

We will be adding documentation and internal checks for these in the near future.

@zbeekman
Copy link
Contributor

zbeekman commented Oct 31, 2017 via email

@kennyweiss
Copy link
Member Author

kennyweiss commented Oct 31, 2017

Let's make it a different PR to keep it separate from the fortran fixes.

@zbeekman
Copy link
Contributor

zbeekman commented Oct 31, 2017 via email

@white238
Copy link
Member

white238 commented Dec 1, 2017

This maybe caused by gmock/gtest overriding the cmake minimum in their code. It is at the top level CMakeLists.txt.

cmake_minimum_required(VERSION 2.6.2)

This should probably be commented out in our code.

@white238
Copy link
Member

white238 commented Jan 9, 2020

cmake_minimum_required calls were removed and a check was added in BLT to warn if you are below CMake 3.8.

@white238 white238 closed this as completed Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants