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

FindCelero.cmake or CeleroConfig.cmake #98

Closed
erikzenker opened this issue Oct 14, 2016 · 7 comments
Closed

FindCelero.cmake or CeleroConfig.cmake #98

erikzenker opened this issue Oct 14, 2016 · 7 comments

Comments

@erikzenker
Copy link

Is there a FindCeleron.cmake or CeleronConfig.cmake available for an easy integration into other projects ?

@DigitalInBlue
Copy link
Owner

There is not. The code would be something like:

set(CELERO_DIRECTORY ${celeroDirectoryDefault} CACHE PATH "")
set(CELERO_INCLUDE_DIR ${CELERO_DIRECTORY}/include CACHE PATH "Celero's include directory.")
set(CELERO_LIBRARY celero CACHE STRING "")

#If celero is "out of tree", we have to add the subdirectory differently.
add_subdirectory(${CELERO_DIRECTORY} ${CMAKE_CURRENT_BINARY_DIR}/celero)

@mloskot
Copy link
Contributor

mloskot commented May 25, 2017

Alternatively, use ExternalProject_Add. Here is how I managed to do it in order to automate clone-build-link workflow for my benchmark https://github.com/mloskot/string_benchmark/

It works locally as well as in CI builds.

@DigitalInBlue DigitalInBlue changed the title FindCeleron.cmake or CeleronConfig.cmake FindCelero.cmake or CeleroConfig.cmake May 10, 2018
@DigitalInBlue
Copy link
Owner

Celero is also included in vcpkg. Using its toolchain file it is found automatically. Still, a FindCelero.cmake should be built.

@mloskot
Copy link
Contributor

mloskot commented Jun 5, 2019

FYI, Celero 2.4 is also available from Conan packages

conan remote add ppodsiadly https://api.bintray.com/conan/ppodsiadly/conan
conan install celero/2.4.0@ppodsiadly/stable

@DigitalInBlue
Copy link
Owner

See celero\cmake\FindCelero.cmake

@weirdo-neutrino
Copy link
Contributor

Here are my thoughts about installation.

CMake documentation

It is said that "Packages provide dependency information to CMake based buildsystems". In turn "CMake provides direct support for two forms of packages, Config-file Packages and Find-module Packages". Also "Indirect support for pkg-config packages is also provided via the FindPkgConfig module".

Solutions

This gives 4 possible solution for upstreams:

  1. documentation
  2. pkg-config
  3. FindModule
  4. config-file

Choice

  1. Documenting the exact place where targets are put is not CMake way. And not a good way in any way. In worse case downstreams have to read code where it is done.
  2. CMake can interoparate with pkg-config in both directions, though it's a little bit clunky. In presence of better options this one is not considered.
  3. CMake states about the third one that "Typically, a find module is needed when the upstream is not built with CMake, or is not CMake-aware enough to otherwise provide a package configuration file".
  4. So ideally we are left with the forth.

Config-file way

This solution won't require FindModule file at all as all necessary information will be generated by CMake on installation. This will change the directory where celero-target.cmake is stored and add celero-config.cmake.

I can pull-request this variant with or without the minimum information about CMake config-file concept so you can make a code review.

@DigitalInBlue
Copy link
Owner

DigitalInBlue commented Apr 6, 2021

@weirdo-neutrino - I agree the CMake configuration here is long in the tooth. I am happy to accept a pull request to modernize it! I simply haven't had time to do it. Thank you for your time and effort!

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

No branches or pull requests

4 participants