-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
CMake prints a spammy warning about "policy CMP0000" #8355
Comments
This affects CMake version >= 3.9.0 so the simplest solution is to use CMake 3.8.x. Last I looked into this I concluded that longterm we need to either fork CMake or convince upstream to allow projects to suppress this warning, as they were allowed to before 3.9.x. Any other solution suggestions are welcome. |
What about not using "the OLD behavior for policy CMP0000", whatever that means? |
IIRC that creates bigger problems than this warning, can't remember the details though. |
Probably worth looking into. |
@tejlmand |
What CMake requires is the line: Setting the CMP0000 allows this line to be placed in another file So CMake tells us we should write: I'm unaware why it was chosen to not write this line in all CMakeLists.txt app files, but I could imagine that it makes life harder if bumping the CMake version in future as all files would need to be updated. Although a search and replace should be easy in this case. Out of curiosity I would like to hear more about what problems placing this line in sample apps is causing. |
Yep. And more importantly, backwards-compatibility with customer applications. |
I wonder, does CMake support multiple invocations of minimum required? Then we would not have a compatibility issue when bumping the version ... |
I imagine they don't, the whole point is for them to be able to determine how CMake should behave as early as possible ... |
Guess it might need to be changed anyway eventually, since the warning says that the behavior will be removed. |
Multiple invocations of cmake_minimum_required is allowed. Imagine if you have project A, e.g. Zephyr, which requires version 3.8, and you then include mbedTLS, which requires, let's say version 3.10 in its CMakeLists.txt file. But versions 3.10 and above are fine, as it satisfies the versions specified for both Zephyr and mbedTLS :) |
@SebastianBoe Do you know why version 3.8.2 is chosen ? For fun, I just tried run CMake version 3.5.1 without any apparent problems (except I had to specify a lower required version) |
Great! Then it is safe to duplicate the version information in every application AFAICT. I can't recall how we landed on 3.8.2, you would have to check the git history, there has been a back-and-forth. If the version is too high it won't be packaged by distrubutions. If the version is too low you will lose out on features and bugfixes. It might have been that we wanted to support 3.8.2 so that users could avoid the issue reported here. But since multiple invocations of cmake_minimum_required is permitted we might not need to work around it any more. |
Still, |
you should disregard files under subsys/ ext/ kernel/, etc. Basically all the files which contains the line project(none) would most likely also need the line cmake_minimum_required() |
@henrikbrixandersen : Yes, not great, but for those that use CMake version > 3.8.x I believe this is the best solution (apart from convincing upstream to re-introduce support for having cmake_minimum_required outside of the toplevel CMakeLists.txt). |
Prepend the text 'cmake_minimum_required(VERSION 3.8.2)' into the application and test build scripts. Modern versions of CMake will spam users with a deprecation warning when the toplevel CMakeLists.txt does not specify a CMake version. This is documented in bug zephyrproject-rtos#8355. To resolve this we include a cmake_minimum_required() line into the toplevel build scripts. Additionally, cmake_minimum_required is invoked from within boilerplate.cmake. The highest version will be enforced. This patch allows us to afterwards change CMake policy CMP000 from OLD to NEW which in turn finally rids us of the verbose warning. The extra boilerplate is considered more acceptable than the verbosity of the CMP0000 policy. Signed-off-by: Sebastian Bøe <[email protected]>
Change CMake policy CMP0000 from OLD to NEW to resolve zephyrproject-rtos#8355. Signed-off-by: Sebastian Bøe <[email protected]>
Prepend the text 'cmake_minimum_required(VERSION 3.8.2)' into the application and test build scripts. Modern versions of CMake will spam users with a deprecation warning when the toplevel CMakeLists.txt does not specify a CMake version. This is documented in bug #8355. To resolve this we include a cmake_minimum_required() line into the toplevel build scripts. Additionally, cmake_minimum_required is invoked from within boilerplate.cmake. The highest version will be enforced. This patch allows us to afterwards change CMake policy CMP000 from OLD to NEW which in turn finally rids us of the verbose warning. The extra boilerplate is considered more acceptable than the verbosity of the CMP0000 policy. Signed-off-by: Sebastian Bøe <[email protected]>
Change CMake policy CMP0000 from OLD to NEW to resolve #8355. Signed-off-by: Sebastian Bøe <[email protected]>
I'm a CMake noob, so I have no idea what the proper fix is here, but having 12 lines of spam about CMP0000 whenever you run CMake is pretty bad:
The text was updated successfully, but these errors were encountered: