Closed erikzenker closed 5 years ago
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)
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.
Celero is also included in vcpkg. Using its toolchain file it is found automatically. Still, a FindCelero.cmake should be built.
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
See celero\cmake\FindCelero.cmake
Here are my thoughts about installation.
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".
This gives 4 possible solution for upstreams:
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.
@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!
Is there a FindCeleron.cmake or CeleronConfig.cmake available for an easy integration into other projects ?