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 example does not build tests #97

Closed
Bu11etmagnet opened this issue Mar 23, 2018 · 9 comments
Closed

CMake example does not build tests #97

Bu11etmagnet opened this issue Mar 23, 2018 · 9 comments
Assignees
Labels
cmake related to CMake support

Comments

@Bu11etmagnet
Copy link

I created a CMake project by copy-pasting the example CMakeLists.txt
I cloned abseil-cpp, cctz and googletest into subdirectories, created a build directory and ran cmake .. there.

Re-run cmake no build system arguments
-- The C compiler identification is Clang 7.0.0
-- The CXX compiler identification is Clang 7.0.0
-- Check for working C compiler: /usr/local/bin/clang
-- Check for working C compiler: /usr/local/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: ~/bin/clang++6
-- Check for working CXX compiler: ~/bin/clang++6 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.14") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
CMake Warning at cctz/CMakeLists.txt:17 (find_package):
  By not providing "Findbenchmark.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "benchmark", but CMake did not find one.

  Could not find a package configuration file provided by "benchmark" with
  any of the following names:

    benchmarkConfig.cmake
    benchmark-config.cmake

  Add the installation prefix of "benchmark" to CMAKE_PREFIX_PATH or set
  "benchmark_DIR" to a directory containing one of the above files.  If
  "benchmark" provides a separate development package or SDK, be sure it has
  been installed.


-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 
-- Could NOT find GMock (missing: GMOCK_LIBRARY GMOCK_MAIN_LIBRARY GMOCK_INCLUDE_DIR GTEST_FOUND) 
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 
-- The following OPTIONAL packages have been found:

 * PythonInterp

-- The following REQUIRED packages have been found:

 * Threads, the system thread library

-- The following REQUIRED packages have not been found:

 * benchmark, a microbenchmark support library, <https://github.com/google/benchmark>
 * GMock, the Google C++ mocking framework, <https://github.com/google/googletest>
 * GTest, the Google C++ test framework, <https://github.com/google/googletest>

CMake Error at /usr/share/cmake-3.9/Modules/FeatureSummary.cmake:459 (message):
  feature_summary() Error: REQUIRED package(s) are missing, aborting CMake
  run.
Call Stack (most recent call first):
  cctz/CMakeLists.txt:140 (feature_summary)


-- Configuring incomplete, errors occurred!

Abseil seems to be unable to find googletest.
benchmark is not mentioned at all in the readme.

@JonathanDCohen
Copy link
Contributor

Please try with -DBUILD_TESTING=OFF

@Bu11etmagnet
Copy link
Author

It works with -DBUILD_TESTING=OFF, but then what's the point of unit tests?

@zhangxy988
Copy link
Contributor

AFAIK, our CMake currently does not, but will soon support building and running the unit tests.
We are under a overhaul of our CMake files. We will update this thread once that is done.

@JonathanDCohen
Copy link
Contributor

Yes, currently our tests only run on Bazel. My goal is to have this remedied by the end of Q2.

@zhangxy988 zhangxy988 added the cmake related to CMake support label Mar 30, 2018
@JonathanDCohen JonathanDCohen changed the title CMake example does not build CMake example does not build tests May 1, 2018
@JonathanDCohen
Copy link
Contributor

Our tests should be running in CMake within the next few days, as I have the change ready to go internally. After review and upstreaming, our tests should run, at least on Linux. At that point I'll close the issue.

@JonathanDCohen
Copy link
Contributor

This is now tracked in #109

@JonathanDCohen
Copy link
Contributor

This should now be fixed on Linux. Please re-open if this problem persists

@Bu11etmagnet
Copy link
Author

CMake now successful, thanks!

@phoad
Copy link

phoad commented May 21, 2018

For future reference, I used
-DBENCHMARK_ENABLE_TESTING=OFF
instead of the proposed flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake related to CMake support
Projects
None yet
Development

No branches or pull requests

4 participants