I was trying to use ExternalProject module:
ExternalProject_Add( googlebenchmark
GIT_REPOSITORY "https://github.com/google/benchmark.git"
TLS_VERIFY ON
CMAKE_CACHE_DEFAULT_ARGS -DBENCHMARK_ENABLE_TESTING:BOOL=OFF
SOURCE_DIR "${CMAKE_BINARY_DIR}/third_party/gbenchmark"
INSTALL_DIR "${CMAKE_BINARY_DIR}/third_party" )`
And there is an issue I've come up with: this module for some reason doesn't forward compiler, used in (parent) cmake, as well as CMAKE_BUILD_TYPE.
I've tried to use CMAKE_CACHE_DEFAULT_ARGS to set CMAKE_CXX_COMPILER directly, but it didn't quiet worked out.
Is there a decent explanation for this behaviour? Is there a proper (cmake-ish) way to forward currently used compiler/build configuration to ExternalProject?
To forward the compiler use the
ExternalProject
argumentCMAKE_CACHE_ARGS
, i.e.: