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

CMake operation generates warnings and errors. #7

Open
NanXiao opened this issue Dec 20, 2017 · 9 comments
Open

CMake operation generates warnings and errors. #7

NanXiao opened this issue Dec 20, 2017 · 9 comments

Comments

@NanXiao
Copy link

NanXiao commented Dec 20, 2017

My OS is Arch Linux, and the cmake version is 3.10.1. When doing cmake, it generates following warnings and errors:

......
CMake Warning (dev) at /usr/share/cmake-3.10/Modules/GoogleTest.cmake:254 (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):
  CMakeLists.txt:77 (GTEST_ADD_TESTS)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at /usr/share/cmake-3.10/Modules/GoogleTest.cmake:254 (if):
  if given arguments:

    "unit-tests" "IN_LIST" "allKeywords"

  Unknown arguments specified
Call Stack (most recent call first):
  CMakeLists.txt:77 (GTEST_ADD_TESTS)


-- Configuring incomplete, errors occurred!
......

Could you help to check it? Thanks very much in advance!

@NanXiao NanXiao changed the title Cmake operation generates warnings and errors. CMake operation generates warnings and errors. Dec 20, 2017
@tbennun
Copy link
Contributor

tbennun commented Dec 20, 2017

It seems to me that the issue is in gtest's CMake. Which version are you using?

@NanXiao
Copy link
Author

NanXiao commented Dec 20, 2017

@tbennun CMake is 3.10.1 and gtest is 1.8.0, thanks!

@tbennun
Copy link
Contributor

tbennun commented Dec 20, 2017

Can you test this with 1.7.0 instead? Thanks.

@NanXiao
Copy link
Author

NanXiao commented Dec 20, 2017

Because Arch Linux shipped with gtest 1.8.0 by default. I need to check how to roll back to old version. BTW, is it possible for you do some modification? Then I can do test on gtest 1.8.0. Thanks!

@tbennun
Copy link
Contributor

tbennun commented Dec 20, 2017

If you extract gtest to win/gtest, CMake should detect this automatically and use it instead.

https://github.com/google/googletest/archive/release-1.7.0.zip

@NanXiao
Copy link
Author

NanXiao commented Dec 21, 2017

I use gtest_discover_tests which introduced in CMake 3.10 to replace gtest_add_tests, and the cmake process can succeed.

@multiplemonomials
Copy link

FWIW, this is caused by a bug in certain versions of CMake. I reported it, and it will be fixed in new releases (v3.12.1 and above).

The workaround for the broken versions is to stick a

cmake_policy(SET CMP0057 NEW)

in your CMake scripts somewhere before calling find_package(GTest).

@tbennun
Copy link
Contributor

tbennun commented Sep 4, 2018

interesting.. Can you create a PR please? Should be relatively short

@yugaoxiang
Copy link

cmake version 3.22.1 也报错了

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

4 participants